Help my tic tac toe codes aren't working




//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;
}





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.
I can't debug it my code doesn't work.
I can't debug it my code doesn't work.


What is your problem?
(It seems your check() function is missing...)
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/
Board is declared. In your code
1
2
3
4
5
6
7
8
9
10
// 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';


erase char:
1
2
3
4
5
6
7
8
9
10
// Assign values to the playing board
Board[0] = '0';
Board[1] = '1';
Board[2] = '2';
Board[3] = '3';
Board[4] = '4';
Board[5] = '5';
Board[6] = '6';
Board[7] = '7';
Board[8] = '8';




FredFlinstone Im really really thank you! i didn't know that
Topic archived. No new replies allowed.