Math Test using Input Files

Hi I am working on a Team Project, to create a Math Test, my side is Algebra. I have 2 input Files, and 2 Functions. What I am wanting to do is compare both Files so that when the user inputs an answer, the answer is compared to the Answer File.
Any help would be appreciated.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

void getFiles();
string getAnswer(string ans);
string problem[5];
string answer[5];
string useranswer;
ifstream inFile1;
ifstream inFile2;

int main(){
getFiles();


}


void getFiles(){

inFile1.open("Answers.txt");
inFile2.open("Problems.txt");

for (int i = 0; i < 5; i++){
getline(inFile2, problem[i]);
inFile1 >> answer[i];
}

for (int i = 0; i < 5; ++i){
string answer;
inFile1 >> answer;
cout << "Use the remainder theorem and synthetic division to find f(k) for the given value of k. " << endl;
cout << problem[i] << endl;
cin >> useranswer;
cout << getAnswer(answer);
}
}



string getAnswer(string ans){
if (ans == useranswer)
return "Correct";
else
return "Incorrect";
}












Topic archived. No new replies allowed.