hello i'm making a tic tac toe game(my first game actually)
but i get an weird error at the end of the main function ( the "}" ) so can someone take a look at my code. the code is not done but it should work anyway...
my compiler says you need a while loop... Which actually makes sense, cuz it's always do-while right? (I'm still a bit of a beginner, so I'm not really sure..)
why do you need a do{} construct anyway? What is the aim, just to output the content on the tic-tac-toe board? If so there is no need for a do {} construct you can just output it like so:
if you're using 'int main()...' shouldn't you be returning a return-value to the operating system that executes your program after your program is complete? maybe your compiler is looking for a "return #" prior to your closing curly-brace for the 'main' function.
#include <iostream>
usingnamespace std;
int main() {
// creates all variables
char cSquare1('1');
char cSquare2('2');
char cSquare3('3');
char cSquare4('4');
char cSquare5('5');
char cSquare6('6');
char cSquare7('7');
char cSquare8('8');
char cSquare9('9');
int iTurn(1);
bool bGameOver(true);
char cTurn('X');
do {
cout << cSquare1 << cSquare2 << cSquare3 << endl;
} while (bGameOver == false); // You need to give a condition to base the loop on... I figure this is what you intended...
return 0; // You probably don't need a return statement, but it is good practice, cause sometimes you do.
}
Fixed.
PS: Is this a Xoax.net tutorial?
Also, excuse the formatting, my IDE auto-formats to the way I like it, and I won't bother reformatting it...