visual studio 2013 C ++ - 控制台输出不可见

时间:2014-11-14 05:32:49

标签: visual-c++

最近我安装了visual studio社区版并尝试编写小型控制台应用程序。 程序正在成功构建。但控制台窗口没有弹出。

有问题,我在我的系统“D”驱动器上安装了visual studio。

我的代码段:

#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

    int main() {
        cout << "Hello world";
        return 0;
    }

请帮助

1 个答案:

答案 0 :(得分:1)

像这样添加cin.get()

int main() {
    cout << "Hello world";

    cin.get(); // <- Waits for any key press directed at the console window
    return 0;
}