hey i cant figure out whats wrong with this im getting errors that don't make sense to me, ill post the lines where the errors are and then ill post the program
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()){
Can someone help me with a c++ program please?
It looks like this code is not in a function, so the C++ compiler thinks you are trying to declare more global variables. I put it into a function and it compiles okay.
int vote;
ifstream voter;
voter.open("ballot.txt");
voter%26gt;%26gt;vote;
while(!voter.eof()){
voter%26gt;%26gt;vote;
Reply:maybe its just the way its showing up in your question but your main() ends right before the line "int vote;" so its not a part of your main() or any other routine.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment