#include <iostream>
using namespace std;

int Main ()
{
    cout << "---------------------------------------------------------------------------------/n";
    cout << "NAME: Justin Chiang/n";
    cout << "COMPUTER LANGUAGES: Python, Lua, C++/n";
    cout << "FAVORITE VIDEO GAME: Starcraft, Diablo/n";
    cout << "I'm taking this class for math undergrad requirement and because it is very useful." << endl;
    system("PAUSE");
    return 0;
}


输出:

1>------ Build started: Project: HW1, Configuration: Debug Win32 ------
1>  HW1.cpp
1>c:\users\asus\desktop\hw1\hw1\hw1.cpp(5): warning C4627: '#include <iostream>':
            skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\asus\desktop\hw1\hw1\hw1.cpp(25): fatal error C1010: unexpected end of file
            while looking for precompiled header. Did you forget to add '#include
            "StdAfx.h"' to your source?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

最佳答案

转到项目属性。单击配置属性/ C / C ++ /预编译头,然后选择“不使用预编译头”选项。确切的指示可能会有所不同,具体取决于您使用的是哪个版本的Visual Studio,但基本上您想关闭预编译的标头。

关于c++ - 基本控制台打印程序,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12345907/

10-14 12:05