String not working with cin!
I'm having an issue with my simple Hello World code.
I'm not able to cin
my name. It says no defined operator ">>" Can someone help please. Below is my code.
#include <i开发者_Go百科ostream>
using namespace std;
int main()
{
int x;
string name;
cout<< "enter name:";
cin>> name;
cout<< "Hello "<< name <<endl;
system("Pause");
}
You have to
#include <string>
.
精彩评论