lions2020
lions2020

Reputation: 1

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 (P.S 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;
  }
}

Upvotes: 0

Views: 55

Answers (1)

vsoftco
vsoftco

Reputation: 56577

cin >> name >> "\n";

should be

cin >> name;

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

Upvotes: 3

Related Questions