C++ Help


 
Thread Tools Search this Thread
Top Forums Programming C++ Help
# 8  
Old 01-08-2009
Code:
board.cpp: In function ‘int main()':
board.cpp:66: error: ‘gameover' was not declared in this scope

That means that gameover wasn't declared. Looking back, I see you called it 'game', not 'gameover', and made it an int, not a bool, so the compiler gives up when it can't find the variable gameover anywhere. Fine, change the top of the while loop into while(game == 1)

Code:
board.cpp: At global scope:
board.cpp:95: error: expected constructor, destructor, or type conversion before ‘<<' token
board.cpp:97: error: expected declaration before ‘}' token

{ }'s always come in pairs surrounding one or more lines of code, if the compiler finds a } without a { it will stop with an error like it did on line 97. You have lots and lots of extra }'s, which also indirectly causes the error on line 95 -- the compiler thinks main()'s code block has already closed at this point, and won't let you call cout outside of a function. Remove these lines:
Code:
}

cout <<endl;

}

k++;

if( k ==42){

game =0;

}

}

Also, take a close look at where you have these lines:
Code:
k++;

if( k ==42){

game =0;

}

This is outside the loop I gave you, and would never have ran until the game already ended, which I don't think is what you want. Look for where I say you need to check for game over.
Quote:
Is there bits i need to change because i don't really understand it
What would you like explained? I wrote it as clearly as I know how.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question