Okay, so I know I opened it up there....
but seriously guys..... I keep getting a syntax error over a stupid ";" and can't figure it out! I thought I was just tired last night, but I can't find it this morning either.
Anyone see it????
(just a note here....I am aware that I am not finished with this yet, I have more to write on it)
// January 25, 2007
// This exam grader program will read file contents and display a list
// of questions missed, with correct answer, total number missed
// percentage correct and if student passed or failed.
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
const int Array_Size = 2;
char correctAnswers[Array_Size];
char studentAnswers[Array_Size];
char name[20];
int count;
int question;
char answer;
fstream inputFile;
void getScores(char []);
main ()
{
//Get students name
cout <<"Enter student's name:\n";
cin >> name;
cout <<"Enter " << name <<"'s answers\n";
//Get scores
getScores(studentAnswers);
//read from file
inputFile.open("StudentAnswers.txt");
for (count = 0; count < Array_Size; count++)
inputFile << studentAnswers[Array_Size] << '\n';
inputFile.close();
inputFile.open("CorrectAnswers.txt");
for (count = 0; count < Array_Size; count++)
inputFile << correctAnswers[Array_Size] << '\n';
inputFile.close();
if (studentAnswers[Array_Size] != correctAnswers[Array_Size])
{
return false;
cout << "Incorrect, your answer was " << studentAnswers[Array_Size] << ",\n";
cout << "The correct answer is " << correctAnswers[Array_Size] <<;
}
return 0;
}
void getScores()
{
for (count = 0; count < Array_Size; count++)
{
cout << question <<":";
question++;
cin >> studentAnswers[answer];
answer++;
}
}
but seriously guys..... I keep getting a syntax error over a stupid ";" and can't figure it out! I thought I was just tired last night, but I can't find it this morning either.
Anyone see it????
(just a note here....I am aware that I am not finished with this yet, I have more to write on it)
// January 25, 2007
// This exam grader program will read file contents and display a list
// of questions missed, with correct answer, total number missed
// percentage correct and if student passed or failed.
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
const int Array_Size = 2;
char correctAnswers[Array_Size];
char studentAnswers[Array_Size];
char name[20];
int count;
int question;
char answer;
fstream inputFile;
void getScores(char []);
main ()
{
//Get students name
cout <<"Enter student's name:\n";
cin >> name;
cout <<"Enter " << name <<"'s answers\n";
//Get scores
getScores(studentAnswers);
//read from file
inputFile.open("StudentAnswers.txt");
for (count = 0; count < Array_Size; count++)
inputFile << studentAnswers[Array_Size] << '\n';
inputFile.close();
inputFile.open("CorrectAnswers.txt");
for (count = 0; count < Array_Size; count++)
inputFile << correctAnswers[Array_Size] << '\n';
inputFile.close();
if (studentAnswers[Array_Size] != correctAnswers[Array_Size])
{
return false;
cout << "Incorrect, your answer was " << studentAnswers[Array_Size] << ",\n";
cout << "The correct answer is " << correctAnswers[Array_Size] <<;
}
return 0;
}
void getScores()
{
for (count = 0; count < Array_Size; count++)
{
cout << question <<":";
question++;
cin >> studentAnswers[answer];
answer++;
}
}