Program Exercise
3. Your teacher at your school requires your help in grading a True/False test. The test answers is stored in a file called Answers.txt. The student responses are stored in a file called Reponses.txt and has the following layout: 999999999 FTFTFTFTFTFTFTFTFTFT
The Answers.txt layout is: FFTFTFTFTFTFTFTFTFTFT
Write a C++ program that reads the answers into an char array of size 20. Your program than reads through the Responses file and calculates the score and percentage mark for each student and displays it to screen in the following format: 999999999 20 50%

Declare a char array of size 20
Declare input stream variables: infile1, infile2
Declare and initialize integers : studNumber, studScore, percentageScore, count;

Open the input files
Read the Answers file until the end of file
Store the answers into the char array

Read the student number into studNumber
Read the Responses file until the end of file
Loop 20 Times
Read the student responses (one character at a time) and store in char array
Compare student responses with answer (is ch[] == response
If true
Add 2 to studScore

Calculate percentage
Display student Number, Score & Percentage
Clear studScore and Percentage
Read the student number into studNumber


7 Years
Discussion Span
Last Post by rinku2142
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.