This is the question asked, your help is very much appreciated :
One of your professors has asked you to write a program to grade her final exams which consist only of 20 multiple-choice questions. Each question has one of four possible answers:A,B,C or D. The file CorrectAnswers.txt , which I attached has the correct answers for all the questions, each answer written on a separate line. The first line contains the answer to the first question, the second line contains the answer to the second question and so forth.
Write a program that reads the contents of the CorrectAnswers.txt file into a one-demensional char array, and then reads the contents of another file (StudentsAnswers.txt which I have attached)containing the student's answers into a second char array. The program should determine the number of questions that the student missed, and then display the following:
-A list of the questions missed by the student, showing the correct answer and the incorrect answer provided by the student for each missed question.
-The total number of questions missed
-the percentage of questions answered correctly (calculated as correctly answered questions/total number of questions.
-If the percentage of correctly answered questions is 70% or greater, the program should indicate that the student passed the exam. Otherwise, it should indicate that the student has failed the exam.
This is what I have so far , I can't figure out how to calculate the missed questions and and show them with the correct answers and incorrect answers. I also don't know exactly how to read the files correctly. am I supposed to put the files in the source files in my project? I could really use some help thanks.
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
const int numOfAnswers= 20;
const int stringSize=1;
char correctAnswers[numOfAnswers][stringSize];
char studentAnswers[numOfAnswers][stringSize];
int totalMissed=0;
ifstream inputFile;
//Open the file StudentAnswers.
inputFile.open("CorrectAnswers.txt");
//Read the 20 answers from the file CorrectAnswers into the char array correctAnswers.
for (int count=0; count < numOfAnswers; count++)
{
inputFile>> correctAnswers[count][stringSize];
}
//close the file.
inputFile.close();
//Open the file StudentAnswers.
inputFile.open("StudentAnswers.txt");
//Read the 20 answers from the file StudentAnswers into the char array studentAnswers.
for (int count=0; count < numOfAnswers; count++)
{
inputFile>> studentAnswers[count][stringSize];
}
//close the file.
inputFile.close();
return 0;
}