The get() function will get exactly the number of characters you specify unless it first encounters the '\n' in the file or end-of-file. Line 20 is asking for 14 characters and that's exactly what you'll get. In the example line you posted it will read "K G Johnson 45", which is probably not what you intended. I think a better way of reading that file is to first read it one character at a time until the first numeric character is encountered. This code too has a couple of minor problems but probably ok for your program.
int count = 0;
int c;
while( !isdigit((c = cin.get()) )
{
name[i][count] = c;
++count;
}
name[i][count] = 0; // null-terminate the string
The size ofclassid is one character too small -- you have to make room for the null terminating byte.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343