Algoritmer och datastrukturer med objektorienterad programmering
Grading a Test
- To be able to write a complete C++ program.
- To be able to use one-dimensional arrays and strings.
- To be able to write a user-defined function with apropriate
return value and parameters.
- To be able to input character data from a file.
Write a program to grade a set of true/false tests. There are 15
true/false questions. True is represented by T, and false is represented
by F. The program reads input from a file and produce output on the
Format of input file
The first line consists of 15 characters representing the key to the quiz.
The rest of hte lines are student responses, one per line.
Each student's name (maximum of 15 characters) immediately follows the
student's last answer.
Processing of the file terminates when end-of-file is reached.
Format of output
For each student write out the name followed by the number of
questions answered correctly and the number missed.
Sample of data
Here is a sample of the data:
The data as described in the Problem Statement. Here are the first three
lines of input:
Each student's name followed by the number of questions answered correctly
and the number missed:
Joe Jones 15 0
Janet Jerome 14 1
- Your solution must use a function to calculate the number of
answers correct (or missed) given the apropriate parameters. The
function shall return an integer.
- Use the file Quiz.dat as input to your program.
Please follow these submission instructions.
- A properly commented listing of your program.
- A listing of your output file serving as a sample run with
"quiz.dat" as input.
Anders Berglund office + 46 (18) 471 31 67
Department of Computer Systems mobile + 46 (70) 425 02 11
P.O. Box 325 fax, direct + 46 (70) 411 02 14
S-751 05 Uppsala fax, dept + 46 (18) 55 02 25