最近我安装了visual studio社区版并尝试编写小型控制台应用程序。 程序正在成功构建。但控制台窗口没有弹出。
有问题,我在我的系统“D”驱动器上安装了visual studio。
我的代码段:
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << "Hello world";
return 0;
}
请帮助
答案 0 :(得分:1)
像这样添加cin.get()
:
int main() {
cout << "Hello world";
cin.get(); // <- Waits for any key press directed at the console window
return 0;
}