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

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜