>\" Can someone help please. Below is my code." />
开发者

String not working with cin!

开发者 https://www.devze.com 2023-03-16 18:40 出处:网络
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.

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>.

0

精彩评论

暂无评论...
验证码 换一张
取 消