foreversdf

控制台闪退的主要原因是:代码运行完毕自动退出

解决方案:

  • system("PAUSE");   和system("pause");

    pause是DOS下的一个命令。简单的说就是暂停程序的执行,等待任意键继续执行。

  • std::cin.get();

    cin.get()暂停程序的执行,等待用户输入回车键,继续执行代码。

  •  死循环;   
while (1) {
        int key = _getch();
        if (key == 27) {
            //If Esc is pressed, exit the program.
            break;
        }
    }            

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2021-08-16
  • 2022-12-23
猜你喜欢
  • 2021-11-12
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
相关资源
相似解决方案