dev c ++中的输出问题

时间:2014-10-22 14:16:55

标签: c++ dev-c++

当我运行下面提到的这个代码时,输​​出控制台会出现一小部分然后消失,但是这个代码中的每件事都很好。没有编译错误或警告。我也使用获取字符功能,但同样的问题。 我在win 7,32位上使用dev-c ++ 4.9.9.2版本。该怎么办?

#include <iostream>
using namespace std;
int main ()
{

cout<<"welcm";

return 0;

}

2 个答案:

答案 0 :(得分:2)

您可以在return语句之前使用cin.get()以避免控制台窗口关闭。

答案 1 :(得分:1)

您需要告诉程序在关闭之前等待。

 cout<<"welcm";

 system("pause"); // add this line

 return 0;