True/ false test program

I am need a boost in writing a program that processes test data. I don't know how to start it.
This is what the the question says:


"The teacher needs help in grading a true/ false test. The student's IDs and test answers are store in file (I don't get that). The first entry in the file contains the answers to the test in the form:

tfftffttttfftftftftt
Every other entry in the file is the student ID,
followed by a blank,
followed by the student's response.
For example:

ABC54301 tffftfftftff ttf
Each answer is 2 points, each wrong answer is -1 point and no answer is no points. The output is the student's ID, followed by the answers. followed by the test score, followed by the test grade.

Test scale is: 90% - 100%, A;
80% - 89.99% B;
70% - 79.99% C;
60% - 69.99% D;
0% - 59.99% F."
You should have paid more attention in class.
Nevertheless, if you read up now, it isn't too late.

Playing with files and I/O:
http://www.cplusplus.com/doc/tutorial/basic_io/
http://www.cplusplus.com/doc/tutorial/files/

Something useful like an array to remember the answer key and the student responses:
http://www.cplusplus.com/doc/tutorial/arrays/
http://www.cplusplus.com/doc/tutorial/ntcs/

You'll also have to play with strings to get the student ID. A simple
1
2
string student_id;
gradefile >> student_id;
will suffice to get it. After that, use single character input until you get to the end of line (you will read a '\n'). I suggest you write a function to read just the true/false scores; you can use it to read the key and then each student's responses.

For some clarification, your input file will look something like:

tfftffttttfftftftftt
ABC54301 tffftfftftff ttf
IQX92402 tftffft ttfft  ftfff

Good luck!
I would suggest that instead of hard-coding the answers into your program, you could have the user enter the correct answers and compare them to the answers in the file.
They aren't hard-coded.
The first line of the input file has the correct answers.
Topic archived. No new replies allowed.