Monday, July 27, 2009

Can someone tell me whats wrong with this c++ program?

heres the code with errors i dont know what the hell is wrong, help





int vote;





ifstream voter;


voter.open("ballot.txt");





voter%26gt;%26gt;vote;








while(voter.eof()){





voter%26gt;%26gt;vote;


it says theres like 7 errors in this thing





syntax error missing ; before '.'


missing type specifier


'voter' redefenition


syntax error missing ; before '.'


missing type specifier


'voter' redefenition


those 3 refer to the line


voter.open("ballot.txt");





missing ; before %26gt;%26gt;


missing type specifier


'voter' redefenition


those 3 refer to the line


voter%26gt;%26gt;vote;





syntax error 'while'


syntax error missing ; before '{'


missing function header


those 3 refer to the line


while(!voter.eof()){





2 more lines with errors





voter.close();





void print(int candidate1, int candidate2, int vote1, int vote2){








syntax error missing ; before '.'


missing type specifier


'voter' redefenition


syntax error '}'


missing ; before '}'


syntax error '}'


those refer to this line


voter.close();





}

Can someone tell me whats wrong with this c++ program?
try adding





using namespace::std;





after the include files. it could also be that you are trying to compile your program with a C compiler, not a C++ compiler.

sending flowers

No comments:

Post a Comment