Your intro() function keeps making me me itch
Alternative:
Code:void intro() { char str[] = "Tic-Tac-Toe"; int i; for(i = 0;str[i];++i) { cout << str[i]; Sleep(500); } cout << endl << endl; }
Your intro() function keeps making me me itch
Alternative:
Code:void intro() { char str[] = "Tic-Tac-Toe"; int i; for(i = 0;str[i];++i) { cout << str[i]; Sleep(500); } cout << endl << endl; }
If you understand what you're doing, you're not learning anything.
that makes no difference in the main loop of the program. that works fine. can you please help me with whats not working properly?
Well, at the end of every loop you do z=1;
How could it ever be player 2's turn if you keep making it player 1's turn?
Using a decent indentation scheme and keeping your code blocks to a reasonable size (see below) would probably help you locate those kinds of issues a little easier.
Last edited by itsme86; 08-02-2006 at 01:54 PM.
If you understand what you're doing, you're not learning anything.
Also, you should really consider using a function for determining the winner. That's a lot of unnecessarily duplicated code. Just create a function and pass it the character to check for.
If you understand what you're doing, you're not learning anything.
i cant remember because i havent programmed in quite a while, but can you do this:
Code:if( (arr[0][0]=='X' && arr[0][1]=='X' && arr[0][2]=='X') || (arr[1][0]=='X' && arr[1][1]=='X' && arr[1][2]=='X') || (arr[2][0]=='X' && arr[2][1]=='X' && arr[2][2]=='X') || (arr[0][0]=='X' && arr[1][1]=='X' && arr[2][2]=='X') || (arr[0][2]=='X' && arr[1][1]=='X' && arr[2][0]=='X') ) { cout << endl << p1 << " wins!!!"; z=-1; break; }