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%


Algorithm
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
End-Of-Loop

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

End-Of-Read-Loop

post your code using tag codes and then we will see where you getting wrong

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.