I got rid of most errors and warnings (1 or 2 was I hadn't put the computer in), but still get these:
Code:
C:\Borland\BCC55\zack>bcc32 -I..\include -L..\lib tictactoe
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
tictactoe.cpp:
Error E2379 tictactoe.cpp 47: Statement missing ; in function main() Huh?
Error E2134 tictactoe.cpp 74: Compound statement missing } in function main() For what?
Warning W8004 tictactoe.cpp 74: 'O_or_X' is assigned a value that is never used No AI yet error, I'll fix that later.
in function main()
*** 2 errors in Compile ***
For this:
Code:
#include<iostream>
#include<windows.h>
#include<conio.h>
#include<cstdlib>
using namespace std;
char board[9]={' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '};
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 && board[0]!=X_or_O){board[0]=X_or_O;}
else if(move==2 && board[1]!=X_or_O){board[1]=X_or_O;}
else if(move==3 && board[2]!=X_or_O){board[2]=X_or_O;}
else if(move==4 && board[3]!=X_or_O){board[3]=X_or_O;}
else if(move==5 && board[4]!=X_or_O){board[4]=X_or_O;}
else if(move==6 && board[5]!=X_or_O){board[5]=X_or_O;}
else if(move==7 && board[6]!=X_or_O){board[6]=X_or_O;}
else if(move==8 && board[7]!=X_or_O){board[7]=X_or_O;}
else if(move==9 && board[8]!=X_or_O){board[8]=X_or_O;}
else{
MessageBox(NULL, "Not a valid space", "ERROR", MB_OK);
};
}
DrawBoard(){
cout<<board[1]<<"|"<<board[2]<<"|"<<*board[3]<<"|\n------"<<board[4]<<"|"<<board[4]<<"|"<<board[4]<<"|\n------"<<board[4]<<"|"<<board[8]<<"|"<<board[8]<<"|\n\n";
}
DrawHelpBoard(){
cout<<"1|2|3|\n------4|5|6|\n------7|8|9|";
}
Check(){
if (board[0]='X' && board[1]='X' && board[2]='X'){ return false;}
else if (board[3]=='X' && board[4]=='X' && board[5]=='X'){ return false;}
else if (board[6]=='X' && board[7]=='X' && board[8]=='X'){ return false;}
else if (board[0]=='X' && board[4]=='X' && board[8]=='X'){ return false;}
else if (board[0]=='X' && board[3]=='X' && board[6]=='X'){ return false;}
else if (board[1]=='X' && board[4]=='X' && board[7]=='X'){ return false;}
else if (board[2]=='X' && board[5]=='X' && board[8]=='X'){ return false;}
else if (board[2]=='X' && board[4]=='X' && board[6]=='X'){ return false;}
else if (board[1]=='O' && board[2]=='O' && board[3]='O'){ return false;}
else if (board[4]=='O' && board[4]=='O' && board[4]='O'){ return false;}
else if (board[4]=='O' && board[8]=='O' && board[8]='O'){ return false;}
else if (board[1]=='O' && board[4]=='O' && board[4]='O'){ return false;}
else if (board[2]=='O' && board[4]=='O' && board[8]='O'){ return false;}
else if (board[3]=='O' && board[4]=='O' && board[8]='O'){ return false;}
else if (board[1]=='O' && board[4]=='O' && board[8]='O'){ return false;}
else if (board[3]=='O' && board[4]=='O' && board[4]='O'){ return false;}
else{
return true;
};
}
Thanks, guys!