I get lots of errors for this:
Errors:Code:#include<iostream> #include<windows.h> #include<conio.h> #include<cstdlib> using namespace std; char a1=' '; char a2=' '; char a3=' '; char b1=' '; char b2=' '; char b3=' '; char c1=' '; char c2=' '; char c3=' '; bool Check(); void DrawBoard(); void DrawHelpBoard(); int main(){ cout<<"Tic-Tac-Toe!\n"; int move; char X_or_O; char O_or_X; int xo=rand()%2; if(xo=0){ X_or_O='X'; O_or_X='O'; cout<<"You are X"; if(xo=1){ X_or_O='O'; O_or_X='X'; cout<<"You are O"; } Sleep(2000); while(Check()) clrscr(); DrawBoard(); DrawHelpBoard(); cin>>move; if(move=1 && a1!=X_or_O){a1=X_or_O;} else if(move==2 && a2!=X_or_O){a2=X_or_O;} else if(move==3 && a3!=X_or_O){a3=X_or_O;} else if(move==4 && b1!=X_or_O){b1=X_or_O;} else if(move==5 && b2!=X_or_O){b2=X_or_O;} else if(move==6 && b3!=X_or_O){b3=X_or_O;} else if(move==7 && c1!=X_or_O){c1=X_or_O;} else if(move==8 && c2!=X_or_O){c2=X_or_O;} else if(move==9 && c3!=X_or_O){a1=X_or_O;} else{ MessageBox(NULL, "Not a valid space", "ERROR", MB_OK); }; } void DrawBoard(){ cout<<a1<<"|"<<a2<<"|"<<*a3<<"|\n------"<<b1<<"|"<<b2<<"|"<<b3<<"|\n------"<<c1<<"|"<<c2<<"|"<<c3<<"|\n\n"; } void DrawHelpBoard(){ cout<<"1|2|3|\n------4|5|6|\n------7|8|9|"; } bool Check(){ if (a1='X' && a2='X' && a3='X'){ return FALSE;} else if (b1=='X' && b2='X' && b3='X'){ return FALSE;} else if (c1=='X' && c2='X' && c3='X'){ return FALSE;} else if (a1=='X' && b1='X' && c1='X'){ return FALSE;} else if (a2=='X' && b2='X' && c2='X'){ return FALSE;} else if (a3=='X' && b3='X' && c3='X'){ return FALSE;} else if (a1=='X' && b2='X' && c3='X'){ return FALSE;} else if (a3=='X' && b2='X' && c1='X'){ return FALSE;} else if (a1=='O' && a2='O' && a3='O'){ return FALSE;} else if (b1=='O' && b2='O' && b3='O'){ return FALSE;} else if (c1=='O' && c2='O' && c3='O'){ return FALSE;} else if (a1=='O' && b1='O' && c1='O'){ return FALSE;} else if (a2=='O' && b2='O' && c2='O'){ return FALSE;} else if (a3=='O' && b3='O' && c3='O'){ return FALSE;} else if (a1=='O' && b2='O' && c3='O'){ return FALSE;} else if (a3=='O' && b2='O' && c1='O'){ return FALSE;} else{ return TRUE; }; }
Edited code and posted errorsCode:Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland tictactoe.cpp: Warning W8060 tictactoe.cpp 28: Possibly incorrect assignment in function main( Warning W8060 tictactoe.cpp 32: Possibly incorrect assignment in function main( Warning W8060 tictactoe.cpp 43: Possibly incorrect assignment in function main( Error E2141 tictactoe.cpp 58: Declaration syntax error in function main() Error E2139 tictactoe.cpp 85: Declaration missing ; in function main() Error E2134 tictactoe.cpp 85: Compound statement missing } in function main() Warning W8004 tictactoe.cpp 85: 'xo' is assigned a value that is never used in unction main() Warning W8004 tictactoe.cpp 85: 'O_or_X' is assigned a value that is never used in function main() *** 3 errors in Compile ***



LinkBack URL
About LinkBacks


