DEV C++我在return 前面加了getchar();为什么还是看不到结果啊

来源:百度知道 编辑:UC知道 时间:2024/06/20 18:49:06
哪位高手出来教教小弟啊!!!
我刚装那软件不会用 我就写个最基本的
#include<iostream>
using namespace std;
int main()
{
cout<<"hello,world";
getchar();
return 0;
}
加了也是一闪而过

应该这样:

#include<iostream>
#include <conio.h> //控制台输入输出
using namespace std;
int main()
{
cout<<"hello,world";
getch(); //控制台暂停
return 0;
}

-------------------------------

补充:
这样也可以

#include <iostream>
using namespace std;
int main()
{
cout<<"hello, world";
system("pause");//调用暂停
return 0;
}

我试了一下,在我的机器上它停了,没有一闪而过;

如果你机器上getchar()不好用的话,换成:

char k;
cin>>k;
return 0;

试试吧。

system("pause");

用这个语句也是可以的

亲测,system("pause");可以

将你的代码贴出来看看