Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 01-26-2007, 12:51 PM   #1 (permalink)
 
Newb Techie

Join Date: Jan 2007

Posts: 7

deena

Send a message via AIM to deena
Unhappy am I just an idiot?

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++;
}
}
deena is offline  
Old 01-26-2007, 12:57 PM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default

Remove the last '<<' from the following line:
Code:
 cout << "The correct answer is " << correctAnswers[Array_Size] <<;
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
jaeusm is offline  
Old 01-26-2007, 01:02 PM   #3 (permalink)
 
Newb Techie

Join Date: Jan 2007

Posts: 7

deena

Send a message via AIM to deena
Default

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!!
deena is offline  
Old 01-26-2007, 04:39 PM   #4 (permalink)
 
Super Techie

Join Date: Sep 2005

Posts: 341

hillbillybob

Default

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.
__________________
The greatest measure of a nation is not it\'s army or economy, but by how many people are trying to get in, and how many people are staying!!
Guns, Guts, and Alcohol made America free.
Born American, Die American
Ubuntu - it\'s all about the bun\'s baby!!!
hillbillybob is offline  
Old 01-26-2007, 05:31 PM   #5 (permalink)
 
Newb Techie

Join Date: Jan 2007

Posts: 7

deena

Send a message via AIM to deena
Default

Thank you.
deena is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On