Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
294 views
Welcome To Ask or Share your Answers For Others

1 Answer

<< is for output. Use cin >> arr[x]; for input.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...