You are to write a program that will do the following:
Part 1 (30 pts)
Grade a 30 multiple-choice question exam and print each student’s name
followed by the score (number of correct answers), the appropriate calculated
percentage score (number of correct answers divided by 30), and letter grade
for the exam. (Use the following percentage ranges for letter grades:
<60=F, 60-69=D, 70-79=C, 80-89=B, 90-100=A.)
I can't figure this out at all. I have started it though any suggestions to lead me in the right direction?
//Izabella Pearson
//CIS 150
//Program 7
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
ifstream inFile;
ofstream outFile;
//Open input file
inFile.open ("p7.input.txt");
outFile.open ("p7.output.txt");
if(!inFile)
{
cout << "Cannot open input file. "<<endl; // incase the file is not found
cout << "Error: File can not open "<<endl;
return 1;
}
//Declare any variables
string student;
char key[31];
int grade;
int correct;
char answers[31];
char next;
int i=0;
while(!inFile.eof())
{
inFile.get(key, 31);
inFile.get(answers, 31);
inFile.get(next);
outFile << next << endl;
if(answers!=key, i++)
{
}
}
}