Hi all. I have a problem
I want my program to do the following.
Create a file of student ID #s.
Then, Read the file.
Search for the line of student ID # say 10002.
At that line, input test scores received from input earlier in program.
Initial file should look like:
10001
10002
10003
10004
After output:
10001
10002 65 45 35 34 //or "65,45,35,3 4" does not matter if there are spaces, commas, etc.
10003
10004
Now, I can create the student ID file fine, But I am not sure how to read and output exactly on that line. I am using fstream, but it seems to erase the whole file when it is finished.
Any help is appreciated. Thank you.
I want my program to do the following.
Create a file of student ID #s.
Then, Read the file.
Search for the line of student ID # say 10002.
At that line, input test scores received from input earlier in program.
Initial file should look like:
10001
10002
10003
10004
After output:
10001
10002 65 45 35 34 //or "65,45,35,3 4" does not matter if there are spaces, commas, etc.
10003
10004
Now, I can create the student ID file fine, But I am not sure how to read and output exactly on that line. I am using fstream, but it seems to erase the whole file when it is finished.
Any help is appreciated. Thank you.
Comment