is it right ?

Mar 2, 2013 at 9:15pm
Write a code segment to read a list of 100 names and store it in memory. Assume each name does not contain more than 20 characters.


solution :
char N[100][20];
for(int I=0; I<=99; I++)
cin>>N[I];


is it rightt ???
or i have to right
cin >> N[i][j] ; instead of cin>>N[I];
Mar 2, 2013 at 9:35pm
I prefer using this,,,, works with spaces too

cin.getline(N[I],21);
Last edited on Mar 2, 2013 at 9:43pm
Mar 9, 2013 at 11:30pm
cin >> N[i][j]; reads in a single character, while
cin>>N[I]; reads in an array of characters. In the last case take care of the number of characters being read!
Topic archived. No new replies allowed.