So for this assignment we have to inherit from the base class 'Game'
I think I have with my version named 'ChildGame'
I would like help with checking the syntax of my function calls from main()

/***************************************************************************************
Programmer: C.Backlund
Program: TicTacToe_1.cpp
Purpose: A tic tac toe game
Date Created: May 2010
Notes & Acknowledgements: Inherieted class created by cpolen.
****************************************************************************************/
//headers (if not already included in parent class)

/****************************************************************************************
//parent class by cpolen
//DO NOT TOUCH @ ALL
****************************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

const int MAX = 3;

class Game {
protected:
	char Board[MAX][MAX]; //Store the actually board for the game
	int iTotalMoves; //How many moves have happened in the game

public:
	Game() : iTotalMoves(0)
	{ ResetBoard(); }

	void DrawRow(char cRow[]) {
		//This member function will print out one row of the 3 row tic-tac-toe board
	}

	void DrawGame() {
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
	}

	void ResetBoard() {
		//This member function will reset the board to all blank to start the tic-tac-toe game
		for(int iRow = 0; iRow < MAX; iRow++) {
			for(int iCol = 0; iCol < MAX; iCol++) {
				Board[iRow][iCol] = ' ';
			}
		}
	}

	void UserInput(char cPlayerSymbol) {
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
	}

	bool CheckMove(int iRow, int iColumn) {
		//This member function checks to see if the move was a valid move or not. This is called from UserInput.
	}

	void ComputerMove(char cPlayer, char cComputer) {
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
	}

	bool CheckWin(char cPlayer) {
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
	}
};
// END OF CPOLEN'S CODE 
// AGAIN DO NOT TOUCH ABOVE CODE....
//________________________________________________________________________________________________________________________________
//================================================================================================================================
//--------------------------------------------------------------------------------------------------------------------------------
//child class of polen's code above.......
class ChildGame : public Game
{
protected:
	char Board[MAX][MAX]; //Store the actually board for the game
	int iTotalMoves; //How many moves have happened in the game

public:
	ChildGame() : iTotalMoves(0)
	{ ResetBoard(); }

	void DrawRow(char cRow[]) {
		//This member function will print out one row of the 3 row tic-tac-toe board
	}

	void DrawGame() {
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
	}

	void ResetBoard() {
		//This member function will reset the board to all blank to start the tic-tac-toe game
		for(int iRow = 0; iRow < MAX; iRow++) {
			for(int iCol = 0; iCol < MAX; iCol++) {
				Board[iRow][iCol] = ' ';
			}
		}
	}

	void UserInput(char cPlayerSymbol) {
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
	}

	bool CheckMove(int iRow, int iColumn) {
		//This member function checks to see if the move was a valid move or not. This is called from UserInput.
	}

	void ComputerMove(char cPlayer, char cComputer) {
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
	}

	bool CheckWin(char cPlayer) {
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
	}
};
/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{
	cout<<"main()"<<endl;
	do
	{
		ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
		MyGame.ChildGame::DrawRow(char cRow[]);//create board
		MyGame.ChildGame::DrawGame();//prints board
		MyGame.ChildGame::UserInput(char cPlayerSymbol);//user input
		MyGame.ChildGame::CheckMove(int iRow, int iColumn);
		MyGame.ChildGame::ComputerMove(char cPlayer, char cComputer);
		
	}
	while(MyGame.ChildGame::CheckWin(char cPlayer););
		system ("pause");
		return 0;
	}

Recommended Answers

All 19 Replies

Lots of problems before even touching the polymorphism part. Read the compiler errors. Some will tell you exactly what the problem is. Some are more cryptic.

  1. Any non-void function should have a return statement.
  2. Function calls should not have the type in it (i.e. leave "char" out of the function call). "char" goes in the function prototype, not the function call. Ditto for array brackets [].
  3. :: in a function call is used for namespaces and static functions, not regular function calls with an object. You either specify an object's name or a class name in a function call, but not both (i.e. MyGame.ChildGame::DrawGame() needs to be MyGame.DrawGame() ). You don't need to specify the class. The object has a class associated with it and you are already specifying the object ( MyGame ).

Based on my understanding of your question, you are requesting help to check on your main() function's logic. Hence, I will comment only on the main() function part.

1. Why do you need to declare a ChildGame object in the do..while loop? All you need is only one game.

2. You will need to call CheckWin() after CheckMove() as user's move can win the game. Based on your current logic, computer will make a move even if the user's move wins the game which is not right. Furthermore, the computer's move might eliminate the user's winning move.

**You can use an infinite loop here. But remember to call 'break' when a winner is found as this will break from the loop. Thus, ending the game. Before calling 'break', you may want to call DrawGame() for the last time to update the screen so that user knows whats the winning step. Else, they have no idea whats the winning move. Hope this helps.

2. You will need to call CheckWin() after CheckMove() as user's move can win the game. Based on your current logic, computer will make a move even if the user's move wins the game which is not right. Furthermore, the computer's move might eliminate the user's winning move.

Unless, of course, you write the game properly. In this case it would be impossible for a user to win the game, which makes a call to CheckWin() useless. Any player that actually knows the game can never lose -- including the computer.

Unless, of course, you write the game properly. In this case it would be impossible for a user to win the game, which makes a call to CheckWin() useless. Any player that actually knows the game can never lose -- including the computer.

understandable, but the assignment is just to inherit from the main "game" class without changing it at all. I am suppose to create a child and write my functions.

I know if anyone knows the game that no one will ever lose.
and pretending the intended audience is so no nothing child and this is the first time he/she played tic tac toe, will have to play many times.

Lots of problems before even touching the polymorphism part. Read the compiler errors. Some will tell you exactly what the problem is. Some are more cryptic.

  1. Any non-void function should have a return statement.
  2. Function calls should not have the type in it (i.e. leave "char" out of the function call). "char" goes in the function prototype, not the function call. Ditto for array brackets [].
  3. :: in a function call is used for namespaces and static functions, not regular function calls with an object. You either specify an object's name or a class name in a function call, but not both (i.e. MyGame.ChildGame::DrawGame() needs to be MyGame.DrawGame() ). You don't need to specify the class. The object has a class associated with it and you are already specifying the object ( MyGame ).

more like such...... (haven't adjusted the steps yet just the calls.

/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{
	cout<<"main()"<<endl;
	do
	{
		ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
		MyGame.DrawRow(char cRow[]);//create board
		MyGame.DrawGame();//prints board
		MyGame.UserInput(char cPlayerSymbol);//user input
		MyGame.CheckMove(int iRow, int iColumn);
		MyGame.ComputerMove(char cPlayer, char cComputer);
		
	}
	while(MyGame.CheckWin(char cPlayer););
		system ("pause");
		return 0;
	}

now creating the class function DrawGame(); how do you get that to work, I neevr quite understood the output of a array to the display.

more like such...... (haven't adjusted the steps yet just the calls.

MyGame.DrawRow(char cRow[]);//create board
		MyGame.DrawGame();//prints board
		MyGame.UserInput(char cPlayerSymbol);//user input
		MyGame.CheckMove(int iRow, int iColumn);
		MyGame.ComputerMove(char cPlayer, char cComputer);
		
	}
	while(MyGame.CheckWin(char cPlayer););
		system ("pause");
		return 0;
	}

Calls are still incorrect. Get "char", "int", and "[]" out from between the parentheses.

char someCharArray[3];
                char someChar, someOtherChar;
                int someInt, someOtherInt;
                // initialize the variables

                // now pass the variables to the functions
		MyGame.DrawRow(someCharArray);//create board		
		MyGame.DrawGame();//prints board
		MyGame.UserInput(someChar);//user input
		MyGame.CheckMove(someInt, someOtherInt);
		MyGame.ComputerMove(someChar, someOtherChar);

now creating the class function DrawGame(); how do you get that to work, I neevr quite understood the output of a array to the display.

Output an array like this. Change as needed for your class:

char board[3][3];

//initialize to whatever
for (int row = 0; row < 3; row++)
{
    for (int col = 0; col < 3; col++)
    {
        if ((row + col) % 2 == 0)
            board[row][col] = 'X';
        else
            board[row][col] = 'O';
    }
}

// display the board
for (int row = 0; row < 3; row++)
{
    for (int col = 0; col < 3; col++)
    {
        cout << board[row][col] << ' ';
    }
    cout << endl;
}

Ok now calling the class functions from main seems to have errors in the parameters

MyGame.DrawRow([U]char cRow[][/U]) ;//create board

, why is this? Do I need to initialize some variables in main() or use pointers... or am I just too confused?

int main()
{
	cout<<"main()"<<endl;

	char cPlayerSymbol, cPlayer, cComputer;
	do
	{
		ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
		MyGame.DrawRow(char cRow[]) ;//create board
		MyGame.DrawGame();//prints board
		MyGame.UserInput(char cPlayerSymbol);//user input
		MyGame.CheckMove(int iRow, int iColumn);
		MyGame.ComputerMove(char cPlayer, char cComputer);

	}
	while(MyGame.CheckWin(char cPlayer););
	system ("pause");
	return 0;
}

Ok now calling the class functions from main seems to have errors in the parameters

MyGame.DrawRow([U]char cRow[][/U]) ;//create board

, why is this? Do I need to initialize some variables in main() or use pointers... or am I just too confused?

int main()
{
	cout<<"main()"<<endl;

	char cPlayerSymbol, cPlayer, cComputer;
	do
	{
		ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
		MyGame.DrawRow(char cRow[]) ;//create board
		MyGame.DrawGame();//prints board
		MyGame.UserInput(char cPlayerSymbol);//user input
		MyGame.CheckMove(int iRow, int iColumn);
		MyGame.ComputerMove(char cPlayer, char cComputer);

	}
	while(MyGame.CheckWin(char cPlayer););
	system ("pause");
	return 0;
}

Re-read my earlier posts. You cannot have "int", "char", or "[]" in your function calls.

Will not compile.

MyGame.DrawRow(char cRow[]) ;//create board

Will compile provided you declare a character array called cRow before this line. Again, see my earlier posts for an example.

MyGame.DrawRow(cRow) ;//create board

Re-read my earlier posts. You cannot have "int", "char", or "[]" in your function calls.

Will not compile.

MyGame.DrawRow(char cRow[]) ;//create board

Will compile provided you declare a character array called cRow before this line. Again, see my earlier posts for an example.

MyGame.DrawRow(cRow) ;//create board

it made me define the variables in main

/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{
	cout<<"main()"<<endl;
	char cRow[3];
	char cCol[3];
	char board[cRow][cCol];
	int iRow, iColumn;
	char cPlayerSymbol, cPlayer, cComputer;
	do
	{
		ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
		MyGame.DrawRow(cRow) ;//create board
		MyGame.DrawGame();//prints board
		MyGame.UserInput(cPlayerSymbol);//user input
		MyGame.CheckMove(iRow, iColumn);
		MyGame.ComputerMove(cPlayer, cComputer);

	}
	while(MyGame.CheckWin(cPlayer););
	system ("pause");
	return 0;
}

and how am I suppose to get the column row input from the player when the only information it is passing is that of one "char".
Part of ChildGame class

void UserInput(char cPlayerSymbol) 
	{
		int iRow, iColumn;
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
		cout<<"row" <<endl;
		cin >> iRow;
		cout<<"column"<< endl;
		cin >> iColumn;


	}

it made me define the variables in main

/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{
	cout<<"main()"<<endl;
	char cRow[3];
	char cCol[3];
	char board[cRow][cCol];
	int iRow, iColumn;
	char cPlayerSymbol, cPlayer, cComputer;
	do
	{
		ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
		MyGame.DrawRow(cRow) ;//create board
		MyGame.DrawGame();//prints board
		MyGame.UserInput(cPlayerSymbol);//user input
		MyGame.CheckMove(iRow, iColumn);
		MyGame.ComputerMove(cPlayer, cComputer);

	}
	while(MyGame.CheckWin(cPlayer););
	system ("pause");
	return 0;
}

I'm actually a bit confused by the design your professor provided. Seems to me that the DrawRow function should be only called from the DrawGame function, in which case it should be a private, not a public function. Regardless, I can't see any reason you would call it from main. The comment you have next to your call doesn't fit at all in my view:

MyGame.DrawRow(cRow) ;//create board

DrawRow should draw a row, not create a board.

Generally, Tic Tac Toe games follow logic like this:

// call to the constructor.  Create an empty board

while (/* game not over */)
{
    // draw board
    // ask player for move.
    // verify that it's a good move.  If not, give error message, ask again.

    // draw board
    // check if game is over

    // if not, computer makes a move.
}

// display some message about who won and maybe draw the final board

This will be in main. That's your skeleton pretty much. Don't call DrawRow from main. Call it from DrawBoard. Look at your professor's code. He has way too many public functions in my view, but maybe that is intentional because he hasn't gotten to the public/private concept yet and will later. Anyway, just remember that not all of these functions should be called from main. Some are called from other class functions, even though they are public. Look at the descriptions to see which functions those are and use the skeleton above to match the function calls to the functions that the professor provided.

int main()
{
	char cRow[3];
	char cCol[3];
	char board[cRow][cCol];

This is incorrect. You should not be declaring arrays in main. The arrays are in your class object already. My earlier comments were based on the compiler errors and the syntax required to make them legal calls. You should not be passing any arrays to any functions. You don't need any arrays in main. You already have them in you class.

Two questions
1. I MUST use a pointer to instantiate my tic-tac-toe object. (Use the new and -> operator.) How should I use this?

2. I need help with my AI psuedocode for the computer player?

Thus far it compiles in Visual Studio 2010...

/***************************************************************************************
Programmer: C.Backlund
Program: TicTacToe_1.cpp
Purpose: A tic tac toe game
Date Created: May 2010
Notes & Acknowledgements: Inherited class created by *******.
****************************************************************************************/
//headers (if not already included in parent class)

/****************************************************************************************
//parent class by *******
//DO NOT TOUCH @ ALL
****************************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

const int MAX = 4;

class Game {
protected:
	char Board[MAX][MAX]; //Store the actually board for the game
	int iTotalMoves; //How many moves have happened in the game

public:
	Game() : iTotalMoves(0)
	{ ResetBoard(); }

	void DrawRow(char cRow[]) {
		//This member function will print out one row of the 3 row tic-tac-toe board
	}

	void DrawGame() {
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
	}

	void ResetBoard() {
		//This member function will reset the board to all blank to start the tic-tac-toe game
		for(int iRow = 0; iRow < MAX; iRow++) {
			for(int iCol = 0; iCol < MAX; iCol++) {
				Board[iRow][iCol] = ' ';
			}
		}
	}

	void UserInput(char cPlayerSymbol) {
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
	}

	bool CheckMove(int iRow, int iColumn) {
		//This member function checks to see if the move was a valid move or not. This is called from UserInput.
	}

	void ComputerMove(char cPlayer, char cComputer) {
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
	}

	bool CheckWin(char cPlayer) {
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
	}
};
// END OF ******** CODE 
// AGAIN DO NOT TOUCH ABOVE Class....
//________________________________________________________________________________________________________________________________
//================================================================================================================================



//--------------------------------------------------------------------------------------------------------------------------------
//child class of Game code above.......
class ChildGame : public Game
{
public:
	char cRow[MAX];
	char cCol[MAX];
	char cPlayerSymbol ;
	char cComputerSymbol;
	char x;
	char cPlayer;
	char cComputer;
	char c_player;
	char cAns;
	char move;
	int iColumn;
	int iRow;

	void Turns()
	{
		iTotalMoves++;
		if(CheckWin(cPlayer)==false && iTotalMoves>9)
		{
			cout<<"Cats Game"<<endl;
		}
	}
	//Done: turncounter


	void DrawRow(char cRow[]) 
	{
		//This member function will print out one row of the 3 row tic-tac-toe board
		//initialize to whatever
		cout<<cRow[1]<<"  |  "<<cRow[2]<<"|"<<cRow[3];
	}
	//Done: draws the rows.

	void DrawGame() //done
	{
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
		// display the board
		cout<<"\n   1   2   3\n"<<endl;

		cout<<"1 ";
		DrawRow(Board[1]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"2 ";
		DrawRow(Board[2]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"3 ";
		DrawRow(Board[3]);
		cout<<"\n     "<<endl;
		
	}
	//Done: draws the game


	void UserInput(char cPlayerSymbol) //done
	{
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
		cout<<cPlayerSymbol<<endl;
		cout<<"Row"<<endl;
		cin>>iRow;
		cout<<"Column"<<endl;
		cin>>iColumn;
		CheckMove(iRow, iColumn);
		if (CheckMove(iRow, iColumn)==false)
		{
			cout<<"input is not within range of 1-3"<<endl;
			UserInput(cPlayerSymbol);
		}		//This member function checks to see if the move was a valid move or not. This is called from UserInput.

		else
		{
			Board[iRow][iColumn]=cPlayerSymbol;//sets the move the player selected to the players symbol
		}

	}
	//Done: Player's Input.

	bool CheckMove(int iRow, int iColumn)
	{
		if (iRow<1|| iRow>3||iColumn<1||iColumn>3)
		{
			return false;
		}
		if (Board[iRow][iColumn]==' ')
		{return true;}
		else
		{return false;}
	}

	void ComputerMove(char cPlayer, char cComputer) 
	{
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
		//this is to check to see if the move the player made is inside the bounds of the board
		
		//Winning move

		//horizontal check.
		if (Board[1][1]==' '&&Board[1][2]==cComputerSymbol&&Board[1][3]==cComputerSymbol)
		{Board[1][2]=cComputerSymbol;}
		//#1 top horizontal row

		else if (Board[2][1]==' '&&Board[2][2]==cComputerSymbol&&Board[2][3]==cComputerSymbol)
		{Board[][]=cComputerSymbol;}
		//#2 horizontal row

		else if (Board[3][1]==' '&&Board[3][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{Board[][]=cComputerSymbol;}
		//#3 horizontal row


		else if (Board[][]==' '&&Board[][]==cComputerSymbol&&Board[][]==cComputerSymbol)
		{Board[][]=cComputerSymbol;}
		
		//#1 vertical check.

		//#2 vertical check.
		//#3 vertical check.

		//#1 '/' diaganol check.
		//#2 '\' diaganol check.

		//Blocking move

		//horizontal check.
		//#1 top horizontal row
		//#2 horizontal row
		//#3 horizontal row
		
		//#1 vertical check.
		//#2 vertical check.
		//#3 vertical check.

		//#1 '/' diaganol check.
		//#2 '\' diaganol check.
		
		
		//Next open spot.


		//horizontal check.
		//#1 top horizontal row
		//#2 horizontal row
		//#3 horizontal row
		
		//#1 vertical check.
		//#2 vertical check.
		//#3 vertical check.

		//#1 '/' diaganol check.
		//#2 '\' diaganol check.

	}

	bool CheckWin(char cPlayer) 
	{
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
		//------------------a tie
		//checks player '--'
		for (int i = 1; i < 4; i++)
		{


			if (Board[i][1]==cPlayerSymbol&&Board[i][2]==cPlayerSymbol&&Board[i][3]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<"is the Winner!!!"<<endl;
				return true;
				break;
			}        
		}

		//check player'|'
		for (int j = 1; j < 4; j++)
		{


			if (Board[1][j]==cPlayerSymbol&&Board[2][j]==cPlayerSymbol&&Board[3][j]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
				return true;
				break;
			}
		}


		//checks player'/'
		if (Board[1][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);

		}

		//checks player'\'
		if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);

		}



		//checks AI '--'
		for (int i = 1; i < 4; i++)
		{


			if (Board[i][1]==cComputerSymbol&&Board[i][2]==cComputerSymbol&&Board[i][3]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				return true;
				break;
			}        
		}

		//checks AI '|'
		for (int j = 1; j < 4; j++)
		{


			if (Board[1][j]==cComputerSymbol&&Board[2][j]==cComputerSymbol&&Board[3][j]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				return true;
				break;
			}
		}


		//checks AI '\'
		if (Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);

		}

		//checks AI '/'
		if (Board[1][3]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][1]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);


		}

		return false;

	}


	void PlayGame()
	{
			
		do
		{
			//_______________________sets the player's symbols, once chosen, the opposite is chosen for the computer AI
			cout<<"'X' or 'O'"<<endl;
			cin>>cPlayerSymbol;
			if (cPlayerSymbol=='o')
			{
				cComputerSymbol='x';
			}
			else
			{
				cComputerSymbol='o';
			}
			//_______________________calls game
			DrawGame();//prints board
			UserInput(cPlayerSymbol);
			system("CLS");
			DrawGame();
			//Turns();
			//CheckMove(iRow, iColumn);
			//ComputerMove(cPlayer, cComputer);
			//CheckWin(cPlayer);

		}
		while(cAns=='y' || cAns=='Y');
	}

};
/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{

	cout<<"main()"<<endl;
	ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
	MyGame.PlayGame();

	system ("pause");
	return 0;
}

Two questions
1. I MUST use a pointer to instantiate my tic-tac-toe object. (Use the new and -> operator.) How should I use this?

2. I need help with my AI psuedocode for the computer player?

Thus far it compiles in Visual Studio 2010...

This compiles?

else if (Board[][]==' '&&Board[][]==cComputerSymbol&&Board[][]==cComputerSymbol)
		{Board[][]=cComputerSymbol;}

Regarding the new and ->, if you have a class X and an object of type X named y and a member function of X called z, then you can create an object of type X and call z in two different ways:

X y;
y.z();

or

X* y;
y = new X();
y->z();

Both do the same thing. You use the dot operator when you're dealing with the object itself. You use the -> operator when you are dealing with a pointer to an object.

The "new" command returns a pointer, so "new" and -> and pointers go together.

http://www.cplusplus.com/reference/std/new/operator%20new/

/***************************************************************************************
Programmer: C.Backlund
Program: TicTacToe_1.cpp
Purpose: A tic tac toe game
Date Created: May 2010
Notes & Acknowledgements: Inherieted class created by cpolen.
****************************************************************************************/
//headers (if not already included in parent class)

/****************************************************************************************
//parent class by cpolen
//DO NOT TOUCH @ ALL
****************************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

const int MAX = 4;

class Game {
protected:
	char Board[MAX][MAX]; //Store the actually board for the game
	int iTotalMoves; //How many moves have happened in the game

public:
	Game() : iTotalMoves(0)
	{ ResetBoard(); }

	void DrawRow(char cRow[]) {
		//This member function will print out one row of the 3 row tic-tac-toe board
	}

	void DrawGame() {
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
	}

	void ResetBoard() {
		//This member function will reset the board to all blank to start the tic-tac-toe game
		for(int iRow = 0; iRow < MAX; iRow++) {
			for(int iCol = 0; iCol < MAX; iCol++) {
				Board[iRow][iCol] = ' ';
			}
		}
	}

	void UserInput(char cPlayerSymbol) {
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
	}

	bool CheckMove(int iRow, int iColumn) {
		//This member function checks to see if the move was a valid move or not. This is called from UserInput.
	}

	void ComputerMove(char cPlayer, char cComputer) {
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
	}

	bool CheckWin(char cPlayer) {
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
	}
};
// END OF CPOLEN'S CODE 
// AGAIN DO NOT TOUCH ABOVE CODE....
//________________________________________________________________________________________________________________________________
//================================================================================================================================





















//--------------------------------------------------------------------------------------------------------------------------------
//child class of polen's code above.......
class ChildGame : public Game
{
public:
	char cRow[MAX];
	char cCol[MAX];
	char cPlayerSymbol ;
	char cComputerSymbol;
	char x;
	char cPlayer;
	char cComputer;
	char c_player;
	char cAns;
	char move;
	int iColumn;
	int iRow;



	void DrawRow(char cRow[]) 
	{
		//This member function will print out one row of the 3 row tic-tac-toe board
		//initialize to whatever
		cout<<cRow[1]<<"  |  "<<cRow[2]<<"|"<<cRow[3];
	}
	//Done: draws the rows.

	void DrawGame() //done
	{
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
		// display the board
		cout<<"\n   1   2   3\n"<<endl;

		cout<<"1 ";
		DrawRow(Board[1]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"2 ";
		DrawRow(Board[2]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"3 ";
		DrawRow(Board[3]);
		cout<<"\n     "<<endl;

	}
	//Done: draws the game

	void UserInput(char cPlayerSymbol) //done
	{
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
		cout<<cPlayerSymbol<<endl;
		cout<<"Row"<<endl;
		cin>>iRow;
		cout<<"Column"<<endl;
		cin>>iColumn;
		CheckMove(iRow, iColumn);
		if (CheckMove(iRow, iColumn)==false)
		{
			cout<<"input is not within range of 1-3"<<endl;
			UserInput(cPlayerSymbol);
		}		//This member function checks to see if the move was a valid move or not. This is called from UserInput.

		else
		{
			Board[iRow][iColumn]=cPlayerSymbol;//sets the move the player selected to the players symbol
		}

	}
	//Done: Player's Input.

	bool CheckMove(int iRow, int iColumn)
	{
		if (iRow<1|| iRow>3||iColumn<1||iColumn>3)
		{
			return false;
		}
		if (Board[iRow][iColumn]==' ')
		{return true;}
		else
		{return false;}
	}

	void ComputerMove(char cPlayer, char cComputer) 
	{
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
		//this is to check to see if the move the player made is inside the bounds of the board
		if (Board[0][0]==' '&&Board[0][1]==cComputerSymbol&&Board[0][2]==cComputerSymbol)
		{Board[0][0]=cComputerSymbol;}
		else if (Board[0][0]==cComputerSymbol&&Board[0][1]==' '&&Board[0][2]==cComputerSymbol)
		{Board[0][1]=cComputerSymbol;}
		else if (Board[0][0]==cComputerSymbol&&Board[0][1]==cComputerSymbol&&Board[0][2]==' ')
		{Board[0][2]=cComputerSymbol;}
		if (Board[1][0]==' '&&Board[1][1]==cComputerSymbol&&Board[1][2]==cComputerSymbol)
		{Board[1][0]=cComputerSymbol;}
		else if (Board[1][0]==cComputerSymbol&&Board[1][1]==' '&&Board[1][2]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[1][0]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[1][2]==' ')
		{Board[1][2]=cComputerSymbol;}
		if (Board[2][0]==' '&&Board[2][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol)
		{Board[2][0]=cComputerSymbol;}
		else	if (Board[2][0]==cComputerSymbol&&Board[2][1]==' '&&Board[2][2]==cComputerSymbol)
		{Board[2][1]=cComputerSymbol;}
		else	if (Board[2][0]==cComputerSymbol&&Board[2][1]==cComputerSymbol&&Board[2][2]==' ')
		{Board[2][2]=cComputerSymbol;}
		else if (Board[0][0]==' '&&Board[1][0]==cComputerSymbol&&Board[2][0]==cComputerSymbol)
		{Board[0][0]=cComputerSymbol;}
		else if (Board[0][0]==cComputerSymbol&&Board[1][0]==' '&&Board[2][0]==cComputerSymbol)
		{Board[1][0]=cComputerSymbol;}
		else if (Board[0][0]==cComputerSymbol&&Board[1][0]==cComputerSymbol&&Board[2][0]==' ')
		{Board[2][0]=cComputerSymbol;}
		else if (Board[0][1]==' '&&Board[1][1]==cComputerSymbol&&Board[2][1]==cComputerSymbol)
		{Board[0][1]=cComputerSymbol;}
		else if (Board[0][1]==cComputerSymbol&&Board[1][1]==' '&&Board[2][1]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[0][1]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[2][1]==' ')
		{Board[2][1]=cComputerSymbol;}
		else if (Board[0][2]==' '&&Board[1][2]==cComputerSymbol&&Board[2][2]==cComputerSymbol)
		{Board[0][2]=cComputerSymbol;}
		else if (Board[0][2]==cComputerSymbol&&Board[1][2]==' '&&Board[2][2]==cComputerSymbol)
		{Board[1][2]=cComputerSymbol;}
		else if (Board[0][2]==cComputerSymbol&&Board[1][2]==cComputerSymbol&&Board[2][2]==' ')
		{Board[2][2]=cComputerSymbol;}
		else if (Board[0][0]==' '&&Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol)
		{Board[0][0]=cComputerSymbol;}
		else if (Board[0][0]==cComputerSymbol&&Board[1][1]==' '&&Board[2][2]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[0][0]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[2][2]==' ')
		{Board[2][2]=cComputerSymbol;}
		else if (Board[2][2]==' '&&Board[1][1]==cComputerSymbol&&Board[0][2]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}
		else if (Board[2][2]==cComputerSymbol&&Board[1][1]==' '&&Board[0][2]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[2][2]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[0][2]==' ')
		{Board[0][2]=cComputerSymbol;}

		else if (Board[0][0]==' '&&Board[0][1]==cPlayerSymbol&&Board[0][2]==cPlayerSymbol)
		{Board[0][0]=cComputerSymbol;}
		else if (Board[0][0]==cPlayerSymbol&&Board[0][1]==' '&&Board[0][2]==cPlayerSymbol)
		{Board[0][1]=cComputerSymbol;}
		else if (Board[0][0]==cPlayerSymbol&&Board[0][1]==cPlayerSymbol&&Board[0][2]==' ')
		{Board[0][2]=cComputerSymbol;}
		else if (Board[1][0]==' '&&Board[1][1]==cPlayerSymbol&&Board[1][2]==cPlayerSymbol)
		{Board[1][0]=cComputerSymbol;}
		else if (Board[1][0]==cPlayerSymbol&&Board[1][1]==' '&&Board[1][2]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[1][0]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[1][2]==' ')
		{Board[1][2]=cComputerSymbol;}
		else if (Board[2][0]==' '&&Board[2][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol)
		{Board[2][0]=cComputerSymbol;}
		else if (Board[2][0]==cPlayerSymbol&&Board[2][1]==' '&&Board[2][2]==cPlayerSymbol)
		{Board[2][1]=cComputerSymbol;}
		else if (Board[2][0]==cPlayerSymbol&&Board[2][1]==cPlayerSymbol&&Board[2][2]==' ')
		{Board[2][2]=cComputerSymbol;}
		else if (Board[0][0]==' '&&Board[1][0]==cPlayerSymbol&&Board[2][0]==cPlayerSymbol)
		{Board[0][0]=cComputerSymbol;}
		else if (Board[0][0]==cPlayerSymbol&&Board[1][0]==' '&&Board[2][0]==cPlayerSymbol)
		{Board[1][0]=cComputerSymbol;}
		else if (Board[0][0]==cPlayerSymbol&&Board[1][0]==cPlayerSymbol&&Board[2][0]==' ')
		{Board[2][0]=cComputerSymbol;}
		else if (Board[0][1]==' '&&Board[1][1]==cPlayerSymbol&&Board[2][1]==cPlayerSymbol)
		{Board[0][1]=cComputerSymbol;}
		else if (Board[0][1]==cPlayerSymbol&&Board[1][1]==' '&&Board[2][1]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[0][1]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][1]==' ')
		{Board[2][1]=cComputerSymbol;}
		else if (Board[0][2]==' '&&Board[1][2]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol)
		{Board[0][2]=cComputerSymbol;}
		else if (Board[0][2]==cPlayerSymbol&&Board[1][2]==' '&&Board[2][2]==cPlayerSymbol)
		{Board[1][2]=cComputerSymbol;}
		else if (Board[0][2]==cPlayerSymbol&&Board[1][2]==cPlayerSymbol&&Board[2][2]==' ')
		{Board[2][2]=cComputerSymbol;}
		else if (Board[0][2]==' '&&Board[1][0]==cPlayerSymbol&&Board[2][0]==cPlayerSymbol)
		{Board[0][2]=cComputerSymbol;}
		else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==' '&&Board[2][0]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][0]==' ')
		{Board[2][0]=cComputerSymbol;}
		else if (Board[0][0]==' '&&Board[1][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol)
		{Board[0][0]=cComputerSymbol;}
		else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==' '&&Board[2][2]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}
		else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][2]==' ')
		{Board[2][2]=cComputerSymbol;}

		else if(Board[0][0]==' ')   {Board[0][0]=cComputerSymbol;}
		else if(Board[0][1]==' ')   {Board[0][1]=cComputerSymbol;}
		else if(Board[0][2]==' ')   {Board[0][2]=cComputerSymbol;}
		else if(Board[1][0]==' ')   {Board[1][0]=cComputerSymbol;}
		else if(Board[1][1]==' ')   {Board[1][1]=cComputerSymbol;}
		else if(Board[1][2]==' ')   {Board[1][2]=cComputerSymbol;}
		else if(Board[2][0]==' ')   {Board[2][0]=cComputerSymbol;}
		else if(Board[2][1]==' ')   {Board[2][1]=cComputerSymbol;}
		else {Board[2][2]=cComputerSymbol;}


	}

	bool CheckWin(char cPlayer) 
	{
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
		//------------------a tie
		//checks player '--'
		for (int i = 1; i < 4; i++)
		{


			if (Board[i][1]==cPlayerSymbol&&Board[i][2]==cPlayerSymbol&&Board[i][3]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<"is the Winner!!!"<<endl;
				return true;
				break;
			}




		}

		//check player'|'
		for (int j = 1; j < 4; j++)
		{


			if (Board[1][j]==cPlayerSymbol&&Board[2][j]==cPlayerSymbol&&Board[3][j]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
				return true;
				break;
			}
		}


		//checks player'/'
		if (Board[1][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);

		}

		//checks player'\'
		if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);

		}



		//checks AI '--'
		for (int i = 1; i < 4; i++)
		{


			if (Board[i][1]==cComputerSymbol&&Board[i][2]==cComputerSymbol&&Board[i][3]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				return true;
				break;
			}        
		}

		//checks AI '|'
		for (int j = 1; j < 4; j++)
		{


			if (Board[1][j]==cComputerSymbol&&Board[2][j]==cComputerSymbol&&Board[3][j]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				return true;
				break;
			}
		}


		//checks AI '\'
		if (Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);

		}

		//checks AI '/'
		if (Board[1][3]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][1]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			return true;
			system("pause");
			exit(0);


		}

		return false;

	}

	void symbol()
	{


		//_______________________sets the player's symbols, once chosen, the opposite is chosen for the computer AI
		do
		{
			cout<<"would you like to be x or o?"<<endl;//prints text to screen
			cin>> cPlayerSymbol;//sets symbol to variable

			if (cPlayerSymbol=='o')
			{
				cComputerSymbol='x';//sets comps or second players symbol 
			}
			else
			{
				cComputerSymbol='o';//sets the computers or second players symbol to o
			}
		}
		while(cPlayerSymbol!='x'&&cPlayerSymbol!='o');//parameters for the do while loop
		game();
	}

	//**************************************************************************************************

	void game ()
	{
		if(cPlayerSymbol=='x' || cPlayerSymbol == 'X')
		{
			do 
			{
				DrawGame();

				UserInput(cPlayerSymbol);
				iTotalMoves++;
				CheckWin(cPlayer); 
				DrawGame();

				ComputerMove(cPlayer, cComputer);
				iTotalMoves++;
				CheckWin(cPlayer);
				DrawGame();
			}
			while (cAns=='y'||cAns=='Y');//parameters for the do while loop
		}
		if (cPlayerSymbol=='o' || cPlayerSymbol == 'O')
		{
			do
			{
				DrawGame();

				ComputerMove (cPlayer, cComputer);
				iTotalMoves++;
				CheckWin(cPlayer);
				DrawGame();

				UserInput(cPlayerSymbol);
				iTotalMoves++;
				CheckWin(cPlayer); 
				DrawGame();
			

			}
			while (cAns=='y'||cAns=='Y');//parameters for the do while loop
		}


	}





};
/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{

	cout<<"main()"<<endl;
	ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
	MyGame.DrawGame();
	MyGame.symbol();
	system ("pause");
	return 0;
}

having trouble with the computer's moves not showing up on the board?

/***************************************************************************************
Programmer: C.Backlund
Program: TicTacToe_1.cpp
Purpose: A tic tac toe game
Date Created: May 2010
Notes & Acknowledgements: Inherieted class created by cpolen.
****************************************************************************************/
//headers (if not already included in parent class)

/****************************************************************************************
//parent class by cpolen
//DO NOT TOUCH @ ALL
****************************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

const int MAX = 4;

class Game {
protected:
	char Board[MAX][MAX]; //Store the actually board for the game
	int iTotalMoves; //How many moves have happened in the game

public:
	Game() : iTotalMoves(0)
	{ ResetBoard(); }

	void DrawRow(char cRow[]) {
		//This member function will print out one row of the 3 row tic-tac-toe board
	}

	void DrawGame() {
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
	}

	void ResetBoard() {
		//This member function will reset the board to all blank to start the tic-tac-toe game
		for(int iRow = 0; iRow < MAX; iRow++) {
			for(int iCol = 0; iCol < MAX; iCol++) {
				Board[iRow][iCol] = ' ';
			}
		}
	}

	void UserInput(char cPlayerSymbol) {
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
	}

	bool CheckMove(int iRow, int iColumn) {
		//This member function checks to see if the move was a valid move or not. This is called from UserInput.
	}

	void ComputerMove(char cPlayer, char cComputer) {
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
	}

	bool CheckWin(char cPlayer) {
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
	}
};
// END OF CPOLEN'S CODE 
// AGAIN DO NOT TOUCH ABOVE CODE....
//________________________________________________________________________________________________________________________________
//================================================================================================================================





















//--------------------------------------------------------------------------------------------------------------------------------
//child class of polen's code above.......
class ChildGame : public Game
{
public:
	char cRow[MAX];
	char cCol[MAX];
	char cPlayerSymbol ;
	char cComputerSymbol;
	char x;
	char cPlayer;
	char cComputer;
	char c_player;
	char cAns;
	char move;
	int iColumn;
	int iRow;
	char cWin;

	//*******************************************************************************
	//function DrawRow();
	//parameters char cRow[]
	// this draws the rows for drawgame();
	//*******************************************************************************

	void DrawRow(char cRow[]) 
	{
		//This member function will print out one row of the 3 row tic-tac-toe board
		//initialize to whatever
		cout<<cRow[1]<<"  |  "<<cRow[2]<<"|"<<cRow[3];
	}
	//Done: draws the rows.

	//********************************************************************************
	//function DrawGame()
	//parameters n/a
	// this draws the board to the console output to display to the user
	//********************************************************************************

	void DrawGame() //done
	{
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
		// display the board
		cout<<"\n   1   2   3\n"<<endl;

		cout<<"1 ";
		DrawRow(Board[1]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"2 ";
		DrawRow(Board[2]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"3 ";
		DrawRow(Board[3]);
		cout<<"\n     "<<endl;

	}
	//Done: draws the game


	//*********************************************************************************
	//function UserInput
	//Parameters char cPlayerSymbol
	//this takes the user's input and transulates it to the array and then to the board by draw();
	//**********************************************************************************
	void UserInput(char cPlayerSymbol) //done
	{
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
		cout<<cPlayerSymbol<<endl;
		cout<<"Row"<<endl;
		cin>>iRow;
		cout<<"Column"<<endl;
		cin>>iColumn;
		CheckMove(iRow, iColumn);
		if (CheckMove(iRow, iColumn)==false)
		{
			cout<<"input is not within range of 1-3"<<endl;
			UserInput(cPlayerSymbol);
		}		//This member function checks to see if the move was a valid move or not. This is called from UserInput.

		else
		{
			Board[iRow][iColumn]=cPlayerSymbol;//sets the move the player selected to the players symbol
		}

	}
	//Done: Player's Input.

	//**********************************************************************************
	// function CheckMove()
	//parameters char cPlayer, char cComputer
	// this function checks to see if inputted move is in a valid range
	//**********************************************************************************
	bool CheckMove(int iRow, int iColumn)//done
	{
		if (iRow<1|| iRow>3||iColumn<1||iColumn>3)
		{
			return false;
		}
		if (Board[iRow][iColumn]==' ')
		{return true;}
		else
		{return false;}
	}
	

	//**********************************************************************************
	//function ComputerMove();
	//parameters char cPlayer, char cComputer
	// this is the ai for the computer's moves
	//**********************************************************************************
	void ComputerMove(char cPlayer, char cComputer) 
	{
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
		//this is to check to see if the move the player made is inside the bounds of the board
		if (Board[1][1]==' '&&Board[1][2]==cComputerSymbol&&Board[1][3]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[1][2]==' '&&Board[1][3]==cComputerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[1][2]==cComputerSymbol&&Board[1][3]==' ')
		{Board[1][3]=cComputerSymbol;}

		if (Board[2][1]==' '&&Board[2][2]==cComputerSymbol&&Board[2][3]==cComputerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[2][1]==cComputerSymbol&&Board[2][2]==' '&&Board[2][3]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[2][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[2][3]==' ')
		{Board[2][3]=cComputerSymbol;}

		if (Board[3][1]==' '&&Board[3][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{Board[3][1]=cComputerSymbol;}

		else	if (Board[3][1]==cComputerSymbol&&Board[3][2]==' '&&Board[3][3]==cComputerSymbol)
		{Board[3][2]=cComputerSymbol;}

		else	if (Board[3][1]==cComputerSymbol&&Board[3][2]==cComputerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][1]==cComputerSymbol&&Board[3][1]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][1]==' '&&Board[3][1]==cComputerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][1]==cComputerSymbol&&Board[3][1]==' ')
		{Board[3][1]=cComputerSymbol;}

		else if (Board[1][2]==' '&&Board[2][2]==cComputerSymbol&&Board[3][2]==cComputerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][2]==cComputerSymbol&&Board[2][2]==' '&&Board[3][2]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][2]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][2]==' ')
		{Board[3][2]=cComputerSymbol;}

		else if (Board[1][3]==' '&&Board[2][3]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{Board[1][3]=cComputerSymbol;}

		else if (Board[1][3]==cComputerSymbol&&Board[2][3]==' '&&Board[3][3]==cComputerSymbol)
		{Board[2][3]=cComputerSymbol;}

		else if (Board[1][3]==cComputerSymbol&&Board[2][3]==cComputerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][2]==' '&&Board[3][3]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[3][3]==' '&&Board[2][2]==cComputerSymbol&&Board[1][3]==cComputerSymbol)
		{Board[3][3]=cComputerSymbol;}

		else if (Board[3][3]==cComputerSymbol&&Board[2][2]==' '&&Board[1][3]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[3][3]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[1][3]==' ')
		{Board[1][3]=cComputerSymbol;}



		else if (Board[1][1]==' '&&Board[1][2]==cPlayerSymbol&&Board[1][3]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[1][2]==' '&&Board[1][3]==cPlayerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[1][2]==cPlayerSymbol&&Board[1][3]==' ')
		{Board[1][3]=cComputerSymbol;}

		else if (Board[2][1]==' '&&Board[2][2]==cPlayerSymbol&&Board[2][3]==cPlayerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[2][1]==cPlayerSymbol&&Board[2][2]==' '&&Board[2][3]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[2][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[2][3]==' ')
		{Board[2][3]=cComputerSymbol;}

		else if (Board[3][1]==' '&&Board[3][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{Board[3][1]=cComputerSymbol;}

		else if (Board[3][1]==cPlayerSymbol&&Board[3][2]==' '&&Board[3][3]==cPlayerSymbol)
		{Board[3][2]=cComputerSymbol;}

		else if (Board[3][1]==cPlayerSymbol&&Board[3][2]==cPlayerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][1]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[2][1]==' '&&Board[3][1]==cPlayerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[2][1]==cPlayerSymbol&&Board[3][1]==' ')
		{Board[3][1]=cComputerSymbol;}

		else if (Board[1][2]==' '&&Board[2][2]==cPlayerSymbol&&Board[3][2]==cPlayerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][2]==cPlayerSymbol&&Board[2][2]==' '&&Board[3][2]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][2]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][2]==' ')
		{Board[3][2]=cComputerSymbol;}

		else if (Board[1][3]==' '&&Board[2][3]==cPlayerSymbol&&Board
			[3][3]==cPlayerSymbol)
		{Board[1][3]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][3]==' '&&Board[3][3]==cPlayerSymbol)
		{Board[2][3]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][3]==cPlayerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[2][3]==' '&&Board[2][1]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{Board[1][3]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==' '&&Board[3][1]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][1]==' ')
		{Board[3][1]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==' '&&Board[3][3]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}


		else if(Board[1][1]==' ')   
		{Board[1][1]=cComputerSymbol;}

		else if(Board[1][2]==' ')   
		{Board[1][2]=cComputerSymbol;}

		else if(Board[1][3]==' ')   
		{Board[1][3]=cComputerSymbol;}

		else if(Board[2][1]==' ')   
		{Board[2][1]=cComputerSymbol;}

		else if(Board[2][2]==' ')   
		{Board[2][2]=cComputerSymbol;}

		else if(Board[2][3]==' ')   
		{Board[2][3]=cComputerSymbol;}

		else if(Board[3][1]==' ')   
		{Board[3][1]=cComputerSymbol;}

		else if(Board[3][2]==' ')   
		{Board[3][2]=cComputerSymbol;}

		else 
		{Board[3][3]=cComputerSymbol;}



	}//done//done //done



	//**********************************************************************************
	//function CheckWin();
	//parameters bool type cPlayer
	//purpose to check for winners, or cats game.. if triggered true... then program directs to playagain();
	//***********************************************************************************

	bool CheckWin(int cPlayer) 
	{
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
		//------------------a tie
		//checks player '--'
		for (int i = 1; i < 4; i++)
		{


			if (Board[i][1]==cPlayerSymbol&&Board[i][2]==cPlayerSymbol&&Board[i][3]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<"is the Winner!!!"<<endl;
				cAns='y';
				DrawGame();
				return true;
				system("pause");
				playagain(cAns);
				
				//break;
			}

		}

		//check player'|'
		for (int j = 1; j < 4; j++)
		{
			if (Board[1][j]==cPlayerSymbol&&Board[2][j]==cPlayerSymbol&&Board[3][j]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
				cWin='y';
				DrawGame();
				return true;
				//break;
				system("pause");
				playagain(cAns);
			}
		}


		//checks player'/'
		if (Board[1][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);

		}

		//checks player'\'
		if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);
		}



		//checks AI '--'
		for (int i = 1; i < 4; i++)
		{
			if (Board[i][1]==cComputerSymbol&&Board[i][2]==cComputerSymbol&&Board[i][3]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				cWin='y';
				DrawGame();
				return true;
				system("pause");
				playagain(cAns);
				
				//break;
			}        
		}

		//checks AI '|'
		for (int j = 1; j < 4; j++)
		{
			if (Board[1][j]==cComputerSymbol&&Board[2][j]==cComputerSymbol&&Board[3][j]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				cWin='y';
				DrawGame();
				system("pause");
				return true;
				playagain(cAns);
				
				//break;
			}
		}


		//checks AI '\'
		if (Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);

		}

		//checks AI '/'
		if (Board[1][3]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][1]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);
		}

		else if (iTotalMoves>9 && CheckWin(cPlayer)==false)
		{ 
			//DrawGame();
			cout<<"cats game!"<<endl;//prints text to screen
			system("pause");//pauses screen
			playagain(cAns);
			//leaves for loop
		}
		cWin='n';

	}




	//**********************************************************************************
    //funtion symbol()
	//parameters: n/a
	// this sets the players symbol to x or o and then calls the funtion game();
	//**********************************************************************************
	void symbol()
	{
		//_______________________sets the player's symbols, once chosen, the opposite is chosen for the computer AI
		do
		{

			cout<<"would you like to be x or o?"<<endl;//prints text to screen
			cin>> cPlayerSymbol;//sets symbol to variable

			if (cPlayerSymbol=='o')
			{
				cComputerSymbol='x';//sets comps or second players symbol 
			}
			else
			{
				cComputerSymbol='o';//sets the computers or second players symbol to o
			}
		}
		while(cPlayerSymbol!='x'&&cPlayerSymbol!='o');//parameters for the do while loop
		game();
	}





	//***********************************************************************************
	//function game();
	//parameters n/a
	//purpose; calls the functions needed to play game while switching the players turns.
	//***********************************************************************************
	void game ()
	{
		iTotalMoves=0;
		ResetBoard();//function call
		for (int z=0; z<=iTotalMoves; z++)
		{
			if (iTotalMoves<=9 || CheckWin(cPlayer) != false)
			{
				if(cPlayerSymbol=='x' || cPlayerSymbol == 'X')
				{
					do 
					{
						DrawGame();

						UserInput(cPlayerSymbol);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer); 
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();

						ComputerMove(cPlayer, cComputer);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer);
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();
					}
					while (cWin=='n'||cWin=='N');//parameters for the do while loop
				}
				if (cPlayerSymbol=='o' || cPlayerSymbol == 'O')
				{
					do
					{
						DrawGame();

						ComputerMove (cPlayer, cComputer);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer);
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();

						UserInput(cPlayerSymbol);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer); 
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();


					}
					while (cPlayer==false||cPlayer==false);//parameters for the do while loop
				}
			}


		}
	}//***********************************************************************************




	//************************************************************************************
	//function playagain();
	//parameters char cAns
	//resets game variables and board or exits game
	//************************************************************************************
	void playagain(char cAns)
	{
		cout<<"would you like to play again?(y/n)"<<endl;//function call depending of the choice of the player
		cin>>cAns;//sts value to variable
		if (cAns== 'y' || 'Y')
		{
			iTotalMoves=0;
			ResetBoard();
			cPlayerSymbol='a';
			symbol(); 
		}
		else
		{
			exit(0);
		}
	}




};
/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{

	cout<<"main()"<<endl;
	ChildGame MyGame; //creates an object within the child class of Game (ChildGame)
	MyGame.DrawGame();
	MyGame.symbol();
	system ("pause");
	return 0;
}

alright I figured out the computer move problem
now the damn thing won't exit
and I MUST use a pointer to instantiate my tic-tac-toe object. (Use the new and -> operator.) and I am still not understanding it

/***************************************************************************************
Programmer: C.Backlund
Program: TicTacToe_1.cpp
Purpose: A tic tac toe game
Date Created: May 2010
Notes & Acknowledgements: Inherieted class created by cpolen.
****************************************************************************************/
//headers (if not already included in parent class)

/****************************************************************************************
//parent class by cpolen
//DO NOT TOUCH @ ALL
****************************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

const int MAX = 4;

class Game {
protected:
	char Board[MAX][MAX]; //Store the actually board for the game
	int iTotalMoves; //How many moves have happened in the game

public:
	Game() : iTotalMoves(0)
	{ ResetBoard(); }

	void DrawRow(char cRow[]) {
		//This member function will print out one row of the 3 row tic-tac-toe board
	}

	void DrawGame() {
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
	}

	void ResetBoard() {
		//This member function will reset the board to all blank to start the tic-tac-toe game
		for(int iRow = 0; iRow < MAX; iRow++) {
			for(int iCol = 0; iCol < MAX; iCol++) {
				Board[iRow][iCol] = ' ';
			}
		}
	}

	void UserInput(char cPlayerSymbol) {
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
	}

	bool CheckMove(int iRow, int iColumn) {
		//This member function checks to see if the move was a valid move or not. This is called from UserInput.
	}

	void ComputerMove(char cPlayer, char cComputer) {
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
	}

	bool CheckWin(char cPlayer) {
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
	}
};
// END OF CPOLEN'S CODE 
// AGAIN DO NOT TOUCH ABOVE CODE....
//________________________________________________________________________________________________________________________________
//================================================================================================================================





















//--------------------------------------------------------------------------------------------------------------------------------
//child class of polen's code above.......
class ChildGame : public Game
{
public:
	char cRow[MAX];
	char cCol[MAX];
	char cPlayerSymbol ;
	char cComputerSymbol;
	char x;
	char cPlayer;
	char cComputer;
	char c_player;
	char cAns;
	char move;
	int iColumn;
	int iRow;
	char cWin;

	//*******************************************************************************
	//function DrawRow();
	//parameters char cRow[]
	// this draws the rows for drawgame();
	//*******************************************************************************

	void DrawRow(char cRow[]) 
	{
		//This member function will print out one row of the 3 row tic-tac-toe board
		//initialize to whatever
		cout<<cRow[1]<<"  |  "<<cRow[2]<<"|"<<cRow[3];
	}
	//Done: draws the rows.

	//********************************************************************************
	//function DrawGame()
	//parameters n/a
	// this draws the board to the console output to display to the user
	//********************************************************************************

	void DrawGame() //done
	{
		//This member function will print the entire tic-tac-toe board. This member function calls the
		//DrawRow() function which will draw the rows of the board
		// display the board
		cout<<"\n   1   2   3\n"<<endl;

		cout<<"1 ";
		DrawRow(Board[1]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"2 ";
		DrawRow(Board[2]);
		cout<<"\n  ---|---|---"<<endl;

		cout<<"3 ";
		DrawRow(Board[3]);
		cout<<"\n     "<<endl;

	}
	//Done: draws the game


	//*********************************************************************************
	//function UserInput
	//Parameters char cPlayerSymbol
	//this takes the user's input and transulates it to the array and then to the board by draw();
	//**********************************************************************************
	void UserInput(char cPlayerSymbol) //done
	{
		//This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
		//their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
		//a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
		//sure to check if another X or O is already in that position.
		cout<<cPlayerSymbol<<endl;
		cout<<"Row"<<endl;
		cin>>iRow;
		cout<<"Column"<<endl;
		cin>>iColumn;
		CheckMove(iRow, iColumn);
		if (CheckMove(iRow, iColumn)==false)
		{
			cout<<"input is not within range of 1-3"<<endl;
			UserInput(cPlayerSymbol);
		}		//This member function checks to see if the move was a valid move or not. This is called from UserInput.

		else
		{
			Board[iRow][iColumn]=cPlayerSymbol;//sets the move the player selected to the players symbol
		}

	}
	//Done: Player's Input.

	//**********************************************************************************
	// function CheckMove()
	//parameters char cPlayer, char cComputer
	// this function checks to see if inputted move is in a valid range
	//**********************************************************************************
	bool CheckMove(int iRow, int iColumn)//done
	{
		if (iRow<1|| iRow>3||iColumn<1||iColumn>3)
		{
			return false;
		}
		if (Board[iRow][iColumn]==' ')
		{return true;}
		else
		{return false;}
	}
	

	//**********************************************************************************
	//function ComputerMove();
	//parameters char cPlayer, char cComputer
	// this is the ai for the computer's moves
	//**********************************************************************************
	void ComputerMove(char cPlayer, char cComputer) 
	{
		//This is the code for the computers strategy on how it will make its next move. Ideally you will check all
		//positions on the board and make sure that you block any human player win attempts. Then if there are no
		//human win attempts, make the best move possible.
		//this is to check to see if the move the player made is inside the bounds of the board
		if (Board[1][1]==' '&&Board[1][2]==cComputerSymbol&&Board[1][3]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[1][2]==' '&&Board[1][3]==cComputerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[1][2]==cComputerSymbol&&Board[1][3]==' ')
		{Board[1][3]=cComputerSymbol;}

		if (Board[2][1]==' '&&Board[2][2]==cComputerSymbol&&Board[2][3]==cComputerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[2][1]==cComputerSymbol&&Board[2][2]==' '&&Board[2][3]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[2][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[2][3]==' ')
		{Board[2][3]=cComputerSymbol;}

		if (Board[3][1]==' '&&Board[3][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{Board[3][1]=cComputerSymbol;}

		else	if (Board[3][1]==cComputerSymbol&&Board[3][2]==' '&&Board[3][3]==cComputerSymbol)
		{Board[3][2]=cComputerSymbol;}

		else	if (Board[3][1]==cComputerSymbol&&Board[3][2]==cComputerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][1]==cComputerSymbol&&Board[3][1]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][1]==' '&&Board[3][1]==cComputerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][1]==cComputerSymbol&&Board[3][1]==' ')
		{Board[3][1]=cComputerSymbol;}

		else if (Board[1][2]==' '&&Board[2][2]==cComputerSymbol&&Board[3][2]==cComputerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][2]==cComputerSymbol&&Board[2][2]==' '&&Board[3][2]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][2]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][2]==' ')
		{Board[3][2]=cComputerSymbol;}

		else if (Board[1][3]==' '&&Board[2][3]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{Board[1][3]=cComputerSymbol;}

		else if (Board[1][3]==cComputerSymbol&&Board[2][3]==' '&&Board[3][3]==cComputerSymbol)
		{Board[2][3]=cComputerSymbol;}

		else if (Board[1][3]==cComputerSymbol&&Board[2][3]==cComputerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][2]==' '&&Board[3][3]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[3][3]==' '&&Board[2][2]==cComputerSymbol&&Board[1][3]==cComputerSymbol)
		{Board[3][3]=cComputerSymbol;}

		else if (Board[3][3]==cComputerSymbol&&Board[2][2]==' '&&Board[1][3]==cComputerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[3][3]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[1][3]==' ')
		{Board[1][3]=cComputerSymbol;}



		else if (Board[1][1]==' '&&Board[1][2]==cPlayerSymbol&&Board[1][3]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[1][2]==' '&&Board[1][3]==cPlayerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[1][2]==cPlayerSymbol&&Board[1][3]==' ')
		{Board[1][3]=cComputerSymbol;}

		else if (Board[2][1]==' '&&Board[2][2]==cPlayerSymbol&&Board[2][3]==cPlayerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[2][1]==cPlayerSymbol&&Board[2][2]==' '&&Board[2][3]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[2][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[2][3]==' ')
		{Board[2][3]=cComputerSymbol;}

		else if (Board[3][1]==' '&&Board[3][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{Board[3][1]=cComputerSymbol;}

		else if (Board[3][1]==cPlayerSymbol&&Board[3][2]==' '&&Board[3][3]==cPlayerSymbol)
		{Board[3][2]=cComputerSymbol;}

		else if (Board[3][1]==cPlayerSymbol&&Board[3][2]==cPlayerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][1]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[2][1]==' '&&Board[3][1]==cPlayerSymbol)
		{Board[2][1]=cComputerSymbol;}

		else if (Board[1][1]==cPlayerSymbol&&Board[2][1]==cPlayerSymbol&&Board[3][1]==' ')
		{Board[3][1]=cComputerSymbol;}

		else if (Board[1][2]==' '&&Board[2][2]==cPlayerSymbol&&Board[3][2]==cPlayerSymbol)
		{Board[1][2]=cComputerSymbol;}

		else if (Board[1][2]==cPlayerSymbol&&Board[2][2]==' '&&Board[3][2]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][2]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][2]==' ')
		{Board[3][2]=cComputerSymbol;}

		else if (Board[1][3]==' '&&Board[2][3]==cPlayerSymbol&&Board
			[3][3]==cPlayerSymbol)
		{Board[1][3]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][3]==' '&&Board[3][3]==cPlayerSymbol)
		{Board[2][3]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][3]==cPlayerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}

		else if (Board[2][3]==' '&&Board[2][1]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{Board[1][3]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==' '&&Board[3][1]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][1]==' ')
		{Board[3][1]=cComputerSymbol;}

		else if (Board[1][1]==' '&&Board[2][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{Board[1][1]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==' '&&Board[3][3]==cPlayerSymbol)
		{Board[2][2]=cComputerSymbol;}

		else if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][3]==' ')
		{Board[3][3]=cComputerSymbol;}


		else if(Board[1][1]==' ')   
		{Board[1][1]=cComputerSymbol;}

		else if(Board[1][2]==' ')   
		{Board[1][2]=cComputerSymbol;}

		else if(Board[1][3]==' ')   
		{Board[1][3]=cComputerSymbol;}

		else if(Board[2][1]==' ')   
		{Board[2][1]=cComputerSymbol;}

		else if(Board[2][2]==' ')   
		{Board[2][2]=cComputerSymbol;}

		else if(Board[2][3]==' ')   
		{Board[2][3]=cComputerSymbol;}

		else if(Board[3][1]==' ')   
		{Board[3][1]=cComputerSymbol;}

		else if(Board[3][2]==' ')   
		{Board[3][2]=cComputerSymbol;}

		else 
		{Board[3][3]=cComputerSymbol;}



	}//done//done //done



	//**********************************************************************************
	//function CheckWin();
	//parameters bool type cPlayer
	//purpose to check for winners, or cats game.. if triggered true... then program directs to playagain();
	//***********************************************************************************

	bool CheckWin(int cPlayer) 
	{
		//This member function will check all winning combinations on the board to see if anyone won or if it is a
		//"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
		//have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
		//the game is over (Cats game).
		//------------------a tie
		//checks player '--'
		for (int i = 1; i < 4; i++)
		{


			if (Board[i][1]==cPlayerSymbol&&Board[i][2]==cPlayerSymbol&&Board[i][3]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<"is the Winner!!!"<<endl;
				cAns='y';
				DrawGame();
				return true;
				system("pause");
				playagain(cAns);
				
				//break;
			}

		}

		//check player'|'
		for (int j = 1; j < 4; j++)
		{
			if (Board[1][j]==cPlayerSymbol&&Board[2][j]==cPlayerSymbol&&Board[3][j]==cPlayerSymbol)
			{
				cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
				cWin='y';
				DrawGame();
				return true;
				//break;
				system("pause");
				playagain(cAns);
			}
		}


		//checks player'/'
		if (Board[1][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][3]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);

		}

		//checks player'\'
		if (Board[1][3]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol&&Board[3][1]==cPlayerSymbol)
		{
			cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);
		}



		//checks AI '--'
		for (int i = 1; i < 4; i++)
		{
			if (Board[i][1]==cComputerSymbol&&Board[i][2]==cComputerSymbol&&Board[i][3]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				cWin='y';
				DrawGame();
				return true;
				system("pause");
				playagain(cAns);
				
				//break;
			}        
		}

		//checks AI '|'
		for (int j = 1; j < 4; j++)
		{
			if (Board[1][j]==cComputerSymbol&&Board[2][j]==cComputerSymbol&&Board[3][j]==cComputerSymbol)
			{
				cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
				cWin='y';
				DrawGame();
				system("pause");
				return true;
				playagain(cAns);
				
				//break;
			}
		}


		//checks AI '\'
		if (Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][3]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);

		}

		//checks AI '/'
		if (Board[1][3]==cComputerSymbol&&Board[2][2]==cComputerSymbol&&Board[3][1]==cComputerSymbol)
		{
			cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
			cWin='y';
			DrawGame();
			return true;
			system("pause");
			playagain(cAns);
		}

		else if (iTotalMoves>9 && CheckWin(cPlayer)==false)
		{ 
			//DrawGame();
			cout<<"cats game!"<<endl;//prints text to screen
			system("pause");//pauses screen
			playagain(cAns);
			//leaves for loop
		}
		cWin='n';

	}




	//**********************************************************************************
    //funtion symbol()
	//parameters: n/a
	// this sets the players symbol to x or o and then calls the funtion game();
	//**********************************************************************************
	void symbol()
	{
		//_______________________sets the player's symbols, once chosen, the opposite is chosen for the computer AI
		do
		{

			cout<<"would you like to be x or o?"<<endl;//prints text to screen
			cin>> cPlayerSymbol;//sets symbol to variable

			if (cPlayerSymbol=='o')
			{
				cComputerSymbol='x';//sets comps or second players symbol 
			}
			else
			{
				cComputerSymbol='o';//sets the computers or second players symbol to o
			}
		}
		while(cPlayerSymbol!='x'&&cPlayerSymbol!='o');//parameters for the do while loop
		game();
	}





	//***********************************************************************************
	//function game();
	//parameters n/a
	//purpose; calls the functions needed to play game while switching the players turns.
	//***********************************************************************************
	void game ()
	{
		iTotalMoves=0;
		ResetBoard();//function call
		for (int z=0; z<=iTotalMoves; z++)
		{
			if (iTotalMoves<=9 || CheckWin(cPlayer) != false)
			{
				if(cPlayerSymbol=='x' || cPlayerSymbol == 'X')
				{
					do 
					{
						DrawGame();

						UserInput(cPlayerSymbol);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer); 
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();

						ComputerMove(cPlayer, cComputer);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer);
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();
					}
					while (cWin=='n'||cWin=='N');//parameters for the do while loop
				}
				if (cPlayerSymbol=='o' || cPlayerSymbol == 'O')
				{
					do
					{
						DrawGame();

						ComputerMove (cPlayer, cComputer);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer);
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();

						UserInput(cPlayerSymbol);
						iTotalMoves++;
						CheckMove(iRow, iColumn);
						CheckWin(cPlayer); 
						if (CheckWin(cPlayer)==true)
						{
							break;
						}
						DrawGame();


					}
					while (cPlayer==false||cPlayer==false);//parameters for the do while loop
				}
			}


		}
	}//***********************************************************************************




	//************************************************************************************
	//function playagain();
	//parameters char cAns
	//resets game variables and board or exits game
	//************************************************************************************
	void playagain(char cAns)
	{
		cout<<"would you like to play again?(y/n)"<<endl;//function call depending of the choice of the player
		cin>>cAns;//sts value to variable
		if (cAns== 'y' || 'Y')
		{
			iTotalMoves=0;
			ResetBoard();
			cPlayerSymbol='a';
			symbol(); 
		}
		else
		{
			exit(0);
		}
	}




};
/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{

	cout<<"TicTacToe Game"<<endl;
	ChildGame* MyGame; //creates an object within the child class of Game (ChildGame)
	MyGame = new ChildGame;
	MyGame->DrawGame();
	MyGame->symbol();
	system ("pause");
	return 0;
}

never-mind the pointer problem
now my problem is with exiting the game
it somewhere in bool checkwin(cplayer);

//My program final and I scored a 100% on it.
/***************************************************************************************
Programmer: C.Backlund
Program: TicTacToe_1.cpp
Purpose: A tic tac toe game
Date Created: May 2010
Notes & Acknowledgements: Inherieted class created by cpolen. help with Main() pointer issues, and return true statement in CheckWin() from CPolen; 
Help with the AI issue from k.Williams, assistance from the people @ Daniweb (no code though just hints, they are tough that way)

why is the const int MAX a global variable? is it so all the classes could use it? or is it because if it was in your class, we wouldn't be allowed to change it
because that is the stipulations of the assignment?

****************************************************************************************/
//headers (if not already included in parent class)






/****************************************************************************************
//parent class by cpolen
//DO NOT TOUCH @ ALL
****************************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

const int MAX = 3;

class Game {
protected:
    char Board[MAX][MAX]; //Store the actually board for the game
    int iTotalMoves; //How many moves have happened in the game

public:
    Game() : iTotalMoves(0)
    { ResetBoard(); }

    void DrawRow(char cRow[]) {
        //This member function will print out one row of the 3 row tic-tac-toe board
    }

    void DrawGame() {
        //This member function will print the entire tic-tac-toe board. This member function calls the
        //DrawRow() function which will draw the rows of the board
    }

    void ResetBoard() {
        //This member function will reset the board to all blank to start the tic-tac-toe game
        for(int iRow = 0; iRow < MAX; iRow++) {
            for(int iCol = 0; iCol < MAX; iCol++) {
                Board[iRow][iCol] = ' ';
            }
        }
    }

    void UserInput(char cPlayerSymbol) {
        //This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
        //their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
        //a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
        //sure to check if another X or O is already in that position.
    }

    bool CheckMove(int iRow, int iColumn) {
        //This member function checks to see if the move was a valid move or not. This is called from UserInput.
    }

    void ComputerMove(char cPlayer, char cComputer) {
        //This is the code for the computers strategy on how it will make its next move. Ideally you will check all
        //positions on the board and make sure that you block any human player win attempts. Then if there are no
        //human win attempts, make the best move possible.
    }

    bool CheckWin(char cPlayer) {
        //This member function will check all winning combinations on the board to see if anyone won or if it is a
        //"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
        //have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
        //the game is over (Cats game).
    }
};








//================================================================================================================================
// END OF CPOLEN'S CODE 
// AGAIN DO NOT TOUCH ABOVE CODE....
//________________________________________________________________________________________________________________________________






















//--------------------------------------------------------------------------------------------------------------------------------
//Class "ChildGame" 
//Class Type: Child
//Parent Class: "Game"
//purpose: It operates as Tic Tac Toe Game.
// 
//--------------------------------------------------------------------------------------------------------------------------------

class ChildGame : public Game
{
public:
    char cRow[MAX];
    char cCol[MAX];
    char cPlayerSymbol ;
    char cComputerSymbol;
    char x;
    char cPlayer;
    char cComputer;
    char c_player;
    char cAns;
    char move;
    int iColumn;
    int iRow;
    char cWin;


    //*******************************************************************************
    //function DrawRow();
    //parameters char cRow[]
    // this draws the rows for drawgame();        
    //This member function will print out one row of the 3 row tic-tac-toe board
    //initialize to whatever
    //*******************************************************************************
    void DrawRow(char cRow[]) 
    {
        cout<<cRow[0]<<"  |  "<<cRow[1]<<"|"<<cRow[2];
    }
    //Done: draws the rows.
    //********************************************************************************
    //function DrawGame()
    //parameters n/a
    // this draws the board to the console output to display to the user        
    //This member function will print the entire tic-tac-toe board. This member function calls the
    //DrawRow() function which will draw the rows of the board
    // display the board
    //********************************************************************************
    void DrawGame() //done
    {
        cout<<"\n   0   1   2\n"<<endl;

        cout<<"0 ";
        DrawRow(Board[0]);
        cout<<"\n  ---|---|---"<<endl;

        cout<<"1 ";
        DrawRow(Board[1]);
        cout<<"\n  ---|---|---"<<endl;

        cout<<"2 ";
        DrawRow(Board[2]);
        cout<<"\n     "<<endl;
    }
    //Done: draws the game
    //*********************************************************************************
    //function UserInput
    //Parameters char cPlayerSymbol
    //this takes the user's input and transulates it to the array and then to the board by draw();        
    //This member function will print to the user who's turn it is and ask the player for a column and row coordiante to put
    //their symbol on the tic-tac-toe board. This member function will also check to see if the user's position was
    //a valid place on the board to go to. In other words it checks to see if it is a space on the board and also makes
    //sure to check if another X or O is already in that position.
    //**********************************************************************************
    void UserInput(char cPlayerSymbol) //done
    {
        cout<<"Player  "<<cPlayerSymbol<<"'s Turn"<<endl;
        cout<<"Row"<<endl;
        cin>>iRow;
        cout<<"Column"<<endl;
        cin>>iColumn;
        CheckMove(iRow, iColumn);
        if (CheckMove(iRow, iColumn)==false)
        {
            system("cls");
            DrawGame();
            cout<<"input is not within range of 0-2"<<endl;
            UserInput(cPlayerSymbol);
        }        //This member function checks to see if the move was a valid move or not. This is called from UserInput.
        else
        {
            Board[iRow][iColumn]=cPlayerSymbol;//sets the move the player selected to the players symbol
        }
    }
    //Done: Player's Input.
    //**********************************************************************************
    // function CheckMove()
    //parameters char cPlayer, char cComputer
    // this function checks to see if inputted move is in a valid range
    //**********************************************************************************
    bool CheckMove(int iRow, int iColumn)//done
    {
        if (iRow<0|| iRow>2||iColumn<0||iColumn>2)
        {
            return false;
        }
        if (Board[iRow][iColumn]==' ')
        {return true;}
        else
        {return false;}
    }
    //**********************************************************************************
    //function ComputerMove();
    //parameters char cPlayer, char cComputer
    // this is the ai for the computer's moves        
    //This is the code for the computers strategy on how it will make its next move. Ideally you will check all
    //positions on the board and make sure that you block any human player win attempts. Then if there are no
    //human win attempts, make the best move possible.
    //this is to check to see if the move the player made is inside the bounds of the board
    //**********************************************************************************
    void ComputerMove(char cPlayer, char cComputer) 
    {
        if (Board[0][0]==' '&&Board[0][1]==cComputerSymbol&&Board[0][2]==cComputerSymbol)
        {
            Board[0][0]=cComputerSymbol;
        }
        else if (Board[0][0]==cComputerSymbol&&Board[0][1]==' '&&Board[0][2]==cComputerSymbol)
        {
            Board[0][1]=cComputerSymbol;
        }
        else if (Board[0][0]==cComputerSymbol&&Board[0][1]==cComputerSymbol&&Board[0][2]==' ')
        {
            Board[0][2]=cComputerSymbol;
        }
        if (Board[1][0]==' '&&Board[1][1]==cComputerSymbol&&Board[1][2]==cComputerSymbol)
        {
            Board[1][0]=cComputerSymbol;
        }
        else if (Board[1][0]==cComputerSymbol&&Board[1][1]==' '&&Board[1][2]==cComputerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[1][0]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[1][2]==' ')
        {
            Board[1][2]=cComputerSymbol;
        }
        if (Board[2][0]==' '&&Board[2][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol)
        {
            Board[2][0]=cComputerSymbol;
        }
        else    if (Board[2][0]==cComputerSymbol&&Board[2][1]==' '&&Board[2][2]==cComputerSymbol)
        {
            Board[2][1]=cComputerSymbol;
        }
        else    if (Board[2][0]==cComputerSymbol&&Board[2][1]==cComputerSymbol&&Board[2][2]==' ')
        {
            Board[2][2]=cComputerSymbol;
        }
        else if (Board[0][0]==' '&&Board[1][0]==cComputerSymbol&&Board[2][0]==cComputerSymbol)
        {
            Board[0][0]=cComputerSymbol;
        }
        else if (Board[0][0]==cComputerSymbol&&Board[1][0]==' '&&Board[2][0]==cComputerSymbol)
        {
            Board[1][0]=cComputerSymbol;
        }
        else if (Board[0][0]==cComputerSymbol&&Board[1][0]==cComputerSymbol&&Board[2][0]==' ')
        {
            Board[2][0]=cComputerSymbol;
        }
        else if (Board[0][1]==' '&&Board[1][1]==cComputerSymbol&&Board[2][1]==cComputerSymbol)
        {
            Board[0][1]=cComputerSymbol;
        }
        else if (Board[0][1]==cComputerSymbol&&Board[1][1]==' '&&Board[2][1]==cComputerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[0][1]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[2][1]==' ')
        {
            Board[2][1]=cComputerSymbol;
        }
        else if (Board[0][2]==' '&&Board[1][2]==cComputerSymbol&&Board[2][2]==cComputerSymbol)
        {
            Board[0][2]=cComputerSymbol;
        }
        else if (Board[0][2]==cComputerSymbol&&Board[1][2]==' '&&Board[2][2]==cComputerSymbol)
        {
            Board[1][2]=cComputerSymbol;
        }
        else if (Board[0][2]==cComputerSymbol&&Board[1][2]==cComputerSymbol&&Board[2][2]==' ')
        {
            Board[2][2]=cComputerSymbol;
        }
        else if (Board[0][0]==' '&&Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol)
        {
            Board[0][0]=cComputerSymbol;
        }
        else if (Board[0][0]==cComputerSymbol&&Board[1][1]==' '&&Board[2][2]==cComputerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[0][0]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[2][2]==' ')
        {
            Board[2][2]=cComputerSymbol;
        }
        else if (Board[2][2]==' '&&Board[1][1]==cComputerSymbol&&Board[0][2]==cComputerSymbol)
        {
            Board[2][2]=cComputerSymbol;
        }
        else if (Board[2][2]==cComputerSymbol&&Board[1][1]==' '&&Board[0][2]==cComputerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[2][2]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[0][2]==' ')
        {
            Board[0][2]=cComputerSymbol;
        }








        else if (Board[0][0]==' '&&Board[0][1]==cPlayerSymbol&&Board[0][2]==cPlayerSymbol)
        {
            Board[0][0]=cComputerSymbol;
        }
        else if (Board[0][0]==cPlayerSymbol&&Board[0][1]==' '&&Board[0][2]==cPlayerSymbol)
        {
            Board[0][1]=cComputerSymbol;
        }
        else if (Board[0][0]==cPlayerSymbol&&Board[0][1]==cPlayerSymbol&&Board[0][2]==' ')
        {
            Board[0][2]=cComputerSymbol;
        }
        else if (Board[1][0]==' '&&Board[1][1]==cPlayerSymbol&&Board[1][2]==cPlayerSymbol)
        {
            Board[1][0]=cComputerSymbol;
        }
        else if (Board[1][0]==cPlayerSymbol&&Board[1][1]==' '&&Board[1][2]==cPlayerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[1][0]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[1][2]==' ')
        {
            Board[1][2]=cComputerSymbol;
        }
        else if (Board[2][0]==' '&&Board[2][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol)
        {
            Board[2][0]=cComputerSymbol;
        }
        else if (Board[2][0]==cPlayerSymbol&&Board[2][1]==' '&&Board[2][2]==cPlayerSymbol)
        {
            Board[2][1]=cComputerSymbol;
        }
        else if (Board[2][0]==cPlayerSymbol&&Board[2][1]==cPlayerSymbol&&Board[2][2]==' ')
        {
            Board[2][2]=cComputerSymbol;
        }
        else if (Board[0][0]==' '&&Board[1][0]==cPlayerSymbol&&Board[2][0]==cPlayerSymbol)
        {
            Board[0][0]=cComputerSymbol;
        }
        else if (Board[0][0]==cPlayerSymbol&&Board[1][0]==' '&&Board[2][0]==cPlayerSymbol)
        {
            Board[1][0]=cComputerSymbol;
        }
        else if (Board[0][0]==cPlayerSymbol&&Board[1][0]==cPlayerSymbol&&Board[2][0]==' ')
        {
            Board[2][0]=cComputerSymbol;
        }
        else if (Board[0][1]==' '&&Board[1][1]==cPlayerSymbol&&Board[2][1]==cPlayerSymbol)
        {
            Board[0][1]=cComputerSymbol;
        }
        else if (Board[0][1]==cPlayerSymbol&&Board[1][1]==' '&&Board[2][1]==cPlayerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[0][1]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][1]==' ')
        {
            Board[2][1]=cComputerSymbol;
        }
        else if (Board[0][2]==' '&&Board[1][2]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol)
        {
            Board[0][2]=cComputerSymbol;
        }
        else if (Board[0][2]==cPlayerSymbol&&Board[1][2]==' '&&Board[2][2]==cPlayerSymbol)
        {
            Board[1][2]=cComputerSymbol;
        }
        else if (Board[0][2]==cPlayerSymbol&&Board[1][2]==cPlayerSymbol&&Board[2][2]==' ')
        {
            Board[2][2]=cComputerSymbol;
        }
        else if (Board[0][2]==' '&&Board[1][0]==cPlayerSymbol&&Board[2][0]==cPlayerSymbol)
        {
            Board[0][2]=cComputerSymbol;
        }
        else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==' '&&Board[2][0]==cPlayerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][0]==' ')
        {
            Board[2][0]=cComputerSymbol;
        }
        else if (Board[0][0]==' '&&Board[1][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol)
        {
            Board[0][0]=cComputerSymbol;
        }
        else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==' '&&Board[2][2]==cPlayerSymbol)
        {
            Board[1][1]=cComputerSymbol;
        }
        else if (Board[0][2]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][2]==' ')
        {
            Board[2][2]=cComputerSymbol;
        }

        else if(Board[0][0]==' ')   
        {
            Board[0][0]=cComputerSymbol;
        }
        else if(Board[0][1]==' ')   
        {
            Board[0][1]=cComputerSymbol;
        }
        else if(Board[0][2]==' ')   
        {
            Board[0][2]=cComputerSymbol;
        }
        else if(Board[1][0]==' ')   
        {
            Board[1][0]=cComputerSymbol;
        }
        else if(Board[1][1]==' ')   
        {
            Board[1][1]=cComputerSymbol;
        }
        else if(Board[1][2]==' ')   
        {
            Board[1][2]=cComputerSymbol;
        }
        else if(Board[2][0]==' ')  
        {
            Board[2][0]=cComputerSymbol;
        }
        else if(Board[2][1]==' ')   
        {
            Board[2][1]=cComputerSymbol;
        }
        else 
        {
            Board[2][2]=cComputerSymbol;
        }
    }//done//done //done
    //**********************************************************************************
    //function CheckWin();
    //parameters bool type cPlayer
    //purpose to check for winners, or cats game.. if triggered true... then program directs to playagain();        
    //This member function will check all winning combinations on the board to see if anyone won or if it is a
    //"Cats" game (A tie). Also remember that there is a member variable that keeps track of how many moves
    //have already taken place. There are only 9 moves in the entire game so once the moves are more than 9
    //the game is over (Cats game).
    //------------------a tie
    //checks player '--'
    //***********************************************************************************
    bool CheckWin(int cPlayer) 
    {
        for (int i = 0; i < 3; i++)//checks columns
        {
            if (Board[i][0]==cPlayerSymbol&&Board[i][1]==cPlayerSymbol&&Board[i][2]==cPlayerSymbol)
            {
                system("cls");
                DrawGame();
                cout<<cPlayerSymbol<<"is the Winner!!!"<<endl;
                cAns='y';
                playagain(cAns);
                system("pause");
                return true;
            }
        }

        for (int j = 0; j < 3; j++)//checks rows
        {
            if (Board[0][j]==cPlayerSymbol&&Board[1][j]==cPlayerSymbol&&Board[2][j]==cPlayerSymbol)
            {
                system("cls");
                DrawGame();
                cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
                cWin='y';
                playagain(cAns);
                system("pause");
                return true;
            }
        }
        //checks '/'
        if (Board[0][0]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][2]==cPlayerSymbol)
        {
            system("cls");
            DrawGame();
            cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
            cWin='y';
            playagain(cAns);
            system("pause");
            return true;
        }
        //checks '\'
        if (Board[0][2]==cPlayerSymbol&&Board[1][1]==cPlayerSymbol&&Board[2][0]==cPlayerSymbol)
        {
            system("cls");
            DrawGame();
            cout<<cPlayerSymbol<<" is the Winner!!!"<<endl;
            cWin='y';
            playagain(cAns);
            system("pause");
            return true;
        }
        //checks AI '--'
        for (int i = 0; i < 3; i++)
        {
            if (Board[i][0]==cComputerSymbol&&Board[i][1]==cComputerSymbol&&Board[i][2]==cComputerSymbol)
            {
                system("cls");
                DrawGame();
                cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
                cWin='y';
                playagain(cAns);
                system("pause");
                return true;
            }        
        }
        //checks AI '|'
        for (int j = 0; j < 3; j++)
        {
            if (Board[0][j]==cComputerSymbol&&Board[1][j]==cComputerSymbol&&Board[2][j]==cComputerSymbol)
            {
                system("cls");
                DrawGame();
                cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
                cWin='y';
                playagain(cAns);
                system("pause");
                return true;
                //break;
            }

        }
        //checks AI '\'
        if (Board[0][0]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[2][2]==cComputerSymbol)
        {
            system("cls");
            DrawGame();
            cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
            cWin='y';
            playagain(cAns);
            system("pause");
            return true;

        }
        //checks AI '/'
        if (Board[0][2]==cComputerSymbol&&Board[1][1]==cComputerSymbol&&Board[2][0]==cComputerSymbol)
        {
            system("cls");
            DrawGame();
            cout<<cComputerSymbol<<" is the Winner!!!"<<endl;
            cWin='y';
            playagain(cAns);
            system("pause");
            return true;
        }
        else if (iTotalMoves>9 && CheckWin(cPlayer)==false)
        { 
            system("cls");
            DrawGame();
            cout<<"cats game!"<<endl;
            playagain(cAns);
            system("pause");
        }
        cWin='n';
        return false;
    }
    //**********************************************************************************
    //funtion symbol()
    //parameters: n/a
    // this sets the players symbol to x or o and then calls the funtion game();
    //**********************************************************************************
    void symbol()
    {
        //sets the player's symbols, once chosen, the opposite is chosen for the computer AI
        do
        {

            cout<<"would you like to be x or o? (lowercase only)"<<endl;//prints text to screen
            cin>> cPlayerSymbol;//sets symbol to variable

            if (cPlayerSymbol=='o')
            {
                cComputerSymbol='x';//sets comps or second players symbol 
            }
            else
            {
                cComputerSymbol='o';//sets the computers or second players symbol to o
            }
        }
        while(cPlayerSymbol!='x'&&cPlayerSymbol!='o');//parameters for the do while loop
        game();//triggers game; not in main so the PlayAgain() function works.
    }
    //***********************************************************************************
    //function game();
    //parameters n/a
    //purpose; calls the functions needed to play game while switching the players turns.
    //***********************************************************************************
    void game ()
    {

        iTotalMoves=0;
        ResetBoard();//function call
        for (int z=0; z<=iTotalMoves; z++)
        {
            if (iTotalMoves<=9 || CheckWin(cPlayer) != false)
            {
                if(cPlayerSymbol=='x' || cPlayerSymbol == 'X')
                {
                    do 
                    {
                        system("cls");
                        DrawGame();
                        UserInput(cPlayerSymbol);
                        iTotalMoves++;
                        CheckMove(iRow, iColumn);
                        CheckWin(cPlayer); 
                        if (CheckWin(cPlayer)==true)
                        {
                            break;
                        }
                        system("cls");
                        ComputerMove(cPlayer, cComputer);
                        iTotalMoves++;
                        CheckMove(iRow, iColumn);
                        CheckWin(cPlayer);
                        if (CheckWin(cPlayer)==true)
                        {
                            break;
                        }
                        system("cls");
                    }
                    while (cWin=='n'||cWin=='N');//parameters for the do while loop
                }
                if (cPlayerSymbol=='o' || cPlayerSymbol == 'O')
                {
                    do
                    {


                        ComputerMove (cPlayer, cComputer);
                        DrawGame();
                        iTotalMoves++;
                        CheckMove(iRow, iColumn);
                        CheckWin(cPlayer);
                        if (CheckWin(cPlayer)==true)
                        {
                            break;
                        }
                        //
                        system("cls");
                        DrawGame();
                        UserInput(cPlayerSymbol);
                        DrawGame();
                        iTotalMoves++;
                        CheckMove(iRow, iColumn);
                        CheckWin(cPlayer); 
                        if (CheckWin(cPlayer)==true)
                        {
                            break;
                        }
                        system("cls");


                    }
                    while (cPlayer==false||cPlayer==false);//parameters for the do while loop
                }
            }


        }
    }//***********************************************************************************
    //************************************************************************************
    //function playagain();
    //parameters char cAns
    //resets game variables and board or exits game
    //************************************************************************************
    void playagain(char cAns)
    {
        cout<<"would you like to play again?(y/n)"<<endl;//function call depending of the choice of the player
        cin>>cAns;//sets value to variable

        if (cAns=='n'|| cAns=='N')
        {
            exit(0);
        }        



        if(cAns=='y' || cAns== 'Y')
        {

            iTotalMoves=0;//resets # of moves
            ResetBoard();//resets game array
            cPlayerSymbol='a';//resets game char (so that function will ask the player X or O again)
            symbol(); // ask the player's symbol then calls the game function
        }



    }
    //************************************************************************************
    //Function: Rules();
    //parameters: N/A
    //displays game info on console out screen
    //************************************************************************************
    void Rules()
    {
        cout<<"  _______ _       "<<endl;
        cout<<" |__   __(_)      "<<endl;
        cout<<"    | |   _  ___  "<<endl;
        cout<<"    | |  | |/ __| "<<endl;
        cout<<"    | |  | | (__  "<<endl;
        cout<<"    |_|  |_|\\___| "<<endl;
        cout<<"  _______         "<<endl; 
        cout<<" |__   __|        "<<endl; 
        cout<<"    | | __ _  ___  "<<endl;
        cout<<"    | |/ _` |/ __| "<<endl;
        cout<<"    | | (_| | (__  "<<endl;
        cout<<"    |_|\\__,_|\\___| "<<endl;
        cout<<"  _______         "<<endl;
        cout<<" |__   __|        "<<endl;
        cout<<"    | | ___   ___ "<<endl;
        cout<<"    | |/ _ \\ / _ \\ "<<endl;
        cout<<"    | | (_) |  __/"<<endl;
        cout<<"    |_|\\___/ \\___|"<<endl;
        cout<<"\n\nThis is a Single Player Game \nagainst the Computer Player\n"<<endl;
        system("pause");
        system("cls");
        cout<<"Input your moves base on a row and a column coordinate:"<<endl;

    }
};
/********************************************************************************************************************************
function: main()
parameters:
Purpose:
Notes MY Code......
********************************************************************************************************************************/
int main()
{


    ChildGame* MyGame; //creates an object within the child class of Game (ChildGame)
    MyGame = new ChildGame;
    MyGame->Rules();
    MyGame->DrawGame();
    MyGame->symbol();
    system ("pause");
    return 0;
}

and here is the Grade

Grading Form

Program: Final Program

_50__ Source Program Listing and Proper Execution of Program (50)
It is expected that each student's program will run correctly and produce the correct output.
o Descriptive variable names (that follow naming conventions)
o Logic is correct
o Logic clear and easy to follow
o Proper use of data types and type conversions

_25__ Consistent Coding Style (25)
o Consistent formatting of code
o Alignment of braces so they match
o Constants specified at the beginning of the program
o No Warning messages during compiling

_25__ Inclusion of Comment Lines in Source Code (25)
o Comments at the beginning of the program including course name and number, project name
and number, programmer, due date, etc. and brief program description (See example comment blocks)
o Comments at key locations throughout code (See example in line comments)

________________________________
Possible Points: 100

Points Earned: 100

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.