I'm having a problem like so.
stream>>FirstName;
stream>>LastName;
stream>>IDnum;
cout<
Instead of outputting something such as
John Smith 45
It outputs this...
45n Smith
For some reason, after the LastName is printed, it goes to the beginning of the buffer and writes over the characters. FirstName and LastName are character arrays and not a strings, and that's what they have to be (class assignment). I've tried flush between LastName and IDnum, but that doesn't seem to work. Whats the problem?
2006-11-19
07:44:12
·
2 answers
·
asked by
Harb Frame
3
in
Computers & Internet
➔ Programming & Design
Initiation statements...
char FirstName[10],LastName[15];
int IDnum;
when it reads the stream, not all of the slots in the array are filled, for instance, when "john" is read, only the first 4 are inputted. If this happens, whats the values for the rest of the array slots?
2006-11-19
10:31:08 ·
update #1