cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
is it right ?
is it right ?
Mar 2, 2013 at 9:15pm UTC
Salam rabaya
(14)
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 UTC
joneele
(78)
I prefer using this,,,, works with spaces too
cin.getline(N[I],21);
Last edited on
Mar 2, 2013 at 9:43pm UTC
Mar 9, 2013 at 11:30pm UTC
tcs
(519)
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.