简体   繁体   中英

Error in C++ compiling

So I just started to learn the basics and I tried making a response for a number thing but it gives me an "std::" bind error for the 10th and 13th line. Here is the code (PS I think the last curly bracket was left behind):

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

should be

cin >> name;

in both places you used it. You cannot send an input stream to a string literal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM