所以我刚开始学习基础知识,我尝试对数字做出响应,但它给了我第 10 行和第 13 行的“std::”绑定(bind)错误。 这是代码(P.S 我认为最后一个大括号落在后面):
#include <iostream>
#include <string>
using namespace std;
int main() {
string name;
int FavNum;
cout << "Hello Sir what is your name" << endl;
cin >> name >> "\n";
cout << "Well Hello " << name
<< "What is your Favorite number between 1 and 100" << endl;
cin >> name >> "\n";
if (FavNum > 100) {
cout << "Wow you like big numbers, but sorry you cant use that one" << endl;
} else if (FavNum >= 90) {
cout << "Wow you like huge numbers!" << endl;
} else if (FavNum <= 10) {
cout << "Wow you like smaller numbers!!!" << endl;
} else if (FavNum == 13) {
cout << "Wow your favorite number is the most unluckiest number in the "
"whole entire universe and I don't know many people that would "
"choose this number I'm proud comrad"
<< endl;
} else if (FavNum <= 89) {
cout << "You have a very nice number thats average try again!" << endl;
}
}
最佳答案
cin >> name >> "\n";
应该是
cin >> name;
您在这两个地方都使用了它。您不能将输入流发送到字符串文字。
关于c++ - C++编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33747468/