如何让 C++ 程序暂停,等待用户输入回车后再继续执行
C语言用getchar(); //需要#include <stdio.h>
或者system("PAUSE"); //需要#include <stdlib.h>
C++语言用cin.get(); //需要#include <iostream>
要说明一点的就是以上几种方法都不是一定要用户输入回车才行,用户输入任意键程序都会继续运行。
例子:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!" << endl;
//std::cout << "Hello" << std::endl;
cin.get();
return 0;
}


浙公网安备 33010602011771号