am I just an idiot?

Status
Not open for further replies.

deena

Solid State Member
Messages
7
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++;
}
}
 
Remove the last '<<' from the following line:
Code:
 cout << "The correct answer is " << correctAnswers[Array_Size] [B]<<[/B];

For future reference, when you post a problem, be sure to include the exact compiler error. Also, the code is a bit more readable if you use code tags in this forum :)
 
Thank you so much! I am so new to this I would not have found that. May I see an example of what code tags are? Really, I am very very new to this!!
 
Code:
This is code

You can incase the text with the "code" tags in brackets. Be sure that you include opening and closing code tags. {CODE}{/CODE}, but use square brackets instead of curly brackets.

That would be the easiest for large blocks of code. If you are just adding one or two lines of code, you could click the # button when you are in the edit reply screen.
 
Status
Not open for further replies.
Back
Top Bottom