| TananTanTananTanToink (11) | |
|
//Tic tac toe, by penis // Include the iostream library #include <iostream> #include <string> // Using the standard namespace using namespace std; // Declare Global Variables char Board[9]; // Declare functions void showBoard (); void main() { // Declare the local variables string Player_1_Name; string Player_2_Name; int whose_turn = 1; // 1 means player 1s turn and 2 means player 2 turns. int Move; // Stores where the players wants to move // Assign values to the playing board char Board[0] = '0'; char Board[1] = '1'; char Board[2] = '2'; char Board[3] = '3'; char Board[4] = '4'; char Board[5] = '5'; char Board[6] = '6'; char Board[7] = '7'; char Board[8] = '8'; // Get PLayer names cout << "Player 1: Please enter your name" << endl; cin >> Player_1_Name; cout << "Player 2: Please enter your name" << endl; cin >> Player_2_Name; // Show the board showBoard (); // Tell which player to move if (whose_turn ==1) { cout << Player_1_Name << " :It's yourturn. " << endl; } else { cout << Player_2_Name << " :It's yourturn. " << endl; } // Get the move cout << " Enter the number of the spot where you'd like to move." << endl; cin >> Move; } void showBoard() { cout << endl; cout << Board[0] << " | " << Board[1] << " | " << Board[2] << endl; cout << "--+---+--" << endl; cout << Board[3] << " | " << Board[4] << " | " << Board[5] << endl; cout << "--+---+--" << endl; cout << Board[6] << " | " << Board[7] << " | " << Board[8] << endl; cout << endl; } | |
|
|
|
| cire (2355) | |
Perhaps you could be more specific than "not working."//Tic tac toe, by penis It's possible your problem results from using the wrong body part to press keys. | |
|
|
|
| TananTanTananTanToink (11) | |
| I can't debug it my code doesn't work. | |
|
|
|
| Imadatobanisa (647) | ||
What is your problem? (It seems your check() function is missing...) | ||
|
|
||
| EssGeEich (1009) | |
void main()Begin replacing it with... int main()...Thanks. Also try using code tags, that will help us a lot, take a look here: http://www.cplusplus.com/articles/z13hAqkS/ | |
|
|
|
| FredFlintstone (11) | |||||
Board is declared. In your code
erase char:
| |||||
|
|
|||||
| TananTanTananTanToink (11) | |
| FredFlinstone Im really really thank you! i didn't know that | |
|
|
|