Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Why am I getting this error in Visual Studio 2012 C++?

here's the exact code copied and pasted:

#include <iostream>

using namespace std;

int main()

{

int temp;

string first;

cout << "Enter first name: ";

cin >> first ;

return 0;

}

i'm dumbfounded and really annoyed. i attached a picture. in case you can't see the pic, i'm getting and error on the ">>" and the error says:

Error: no operator ">>" matches these operands. operand types are: std::istream >> std::string

Attachment image

1 Answer

Relevance
  • 7 years ago

    i figured it out...

    i needed to add:

    #include <string>

Still have questions? Get your answers by asking now.