stdafx.h可能否定iostream

时间:2018-01-26 23:55:11

标签: c++ visual-studio

当我尝试使用Visuale工作室(2017社区)构建它时 我收到错误,告诉我要包含“stdafx.h”(代码C1010)
当我这样做时,我得到几个问题,告诉我我有的字符串 如果我忘记了iostream,那么定义的定义和其他只会发生在我身上的问题。这是我使用的唯一编译器,但在线编译器似乎有用(https://onlinegdb.comhttp://cpp.sh

#include <iostream>
#include <string>
using namespace std;
int main()
{
string var1;
std::string pass;
std::cout << "Enter Any word" << std::endl;
std::cin >> pass;
cout << "1.what is 9 x 9" << endl;
std::cin >> var1;
cout << "2.what is 9 x 8" << endl;
std::cin >> var1;
cout << "3.what is 19 x 2" << endl;
std::cin >> var1;
cout << "4.what is 27 x 10" << endl;
std::cin >> var1;
cout << "5.what is 87 x 90" << endl;
std::cin >> var1;
cout << "6.what is 989 + 10" << endl;
std::cin >> var1;
cout << "7.What languages can Putin speak" << endl;
std::cin >> var1;
cout << "8.what is the square of 100" << endl;
std::cin >> var1;
cout << "9.What is the first word in the family guy theme song" << endl;
std::cin >> var1;
cout << "What is the answer to #5" << endl;
std::cin >> var1;
cout << "What is the answer to #7" << endl;
std::cin >> var1;
cout << "What is the answer to #9" << endl;
std::cin >> var1;
cout << "what is 989 + 10" << endl;
std::cin >> var1;
cout << "what was your word?" << endl;
cin >> var1;
if (var1 == pass)
{
    cout << "correct";
}
else
{
    cout << "wrong, you stynk";
}
}

1 个答案:

答案 0 :(得分:2)

您可以转到项目属性 - &gt;来disable use of precompiled headers。 C / C ++ - &gt;预编译标题,然后选择不使用创建

或者,请添加"stdafx.h"并将其他包含移至该文件。

相关问题