C++编译时出错

Error in C++ compiling

本文关键字:出错 编译 C++      更新时间:2023-10-16

所以我刚开始学习基础知识,并尝试对数字进行响应,但它在第10行和第13行给了我一个"std::"绑定错误。这是代码(附言:我认为最后一个花括号被留下了):

#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;

在两个地方都使用了它。不能将输入流发送到字符串文字。