how to input into string array in c++

Posted by Artemis on Stack Overflow See other posts from Stack Overflow or by Artemis
Published on 2013-11-11T03:48:54Z Indexed on 2013/11/11 3:52 UTC
Read the original article Hit count: 189

Filed under:

i want to declare an array of strings and want to input string via CIN command but it gives me an error i am trying to do this name1 name2 name3 . . . and so on... i am entering string to an array dynamical means input from cin

for CIN i use the following code like if i use 3 names to be entered

string arr[3];  
for (int x=0;x<3;x++)
{
cout<<"enter name"<<x<<" ";
cin<<arr[x];
}
for(int z=0;z<3;z++)
cout<<arr[z];

it gives an error NO MATCH FOR CIN....

© Stack Overflow or respective owner

Related posts about c++