Homework assignment

Hi I have a homework assignment and I have to take a previous solution and do a certain set of instructions to it.
Here is the code:
// Program: TicTacToe with loops
// Date: October 20, 2012
// Author: Yours Truly

#include <iostream>
#include <string>
#include "main.h"

using namespace std;

int main(void)
{
bool gameOver = false; // game loop control flag
char posLocation; // user input variable for position choice
char playAgain = 'A'; // program exit control flag
char playerSymbol = 'X'; // current player symbol
string pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9; // board display variables

DisplayIntro(); // Display introduction screen
while( playAgain == 'A' )
{
InitializeGame(gameOver, playerSymbol, pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); // Initializes the game board
DisplayGameBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); // Displays the game board

while( !gameOver ) // Loop until a winner is determined or all squars have been used
{
posLocation = GetValidUserInput(playerSymbol, pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); // Get vaild user inpur
SetGameBoardPosition(posLocation, playerSymbol, pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); // Set the appropriate board position
DisplayGameBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); // Display the game board
gameOver = CheckForGameOver(playerSymbol, pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); // Check for end of game condition and change the player symbol
}
playAgain = RequestAdditionalGame(); // Determine whether to play the game again
}

DisplayCredits(); // Display the credit screen
return 0;
}

char RequestAdditionalGame(void)
{
char userEntry;

cout << "Enter \"A\" to play again, any other key to exit: " << endl << endl; // getting user input for whether the player wants to play again
cin >> userEntry;
userEntry = toupper(userEntry);
cout << endl << endl;

return(userEntry);
}

void UpdatePlayer(char& playerSymbol)
{
if(playerSymbol == 'O') // alternating between the X and O player
playerSymbol = 'X';
else
playerSymbol = 'O';
}

bool CheckForGameOver(char& playerSymbol, string pos1, string pos2, string pos3, string pos4, string pos5, string pos6, string pos7, string pos8, string pos9)
{
if( (pos1 == pos2 && pos1 == pos3) || (pos4 == pos5 && pos4 == pos6) || (pos7 == pos8 && pos7 == pos9) || // checking game victory conditions
(pos1 == pos4 && pos1 == pos7) || (pos2 == pos5 && pos2 == pos8) || (pos3 == pos6 && pos3 == pos9) ||
(pos1 == pos5 && pos1 == pos9) || (pos3 == pos5 && pos3 == pos7) )
{
cout << endl << "Player " << playerSymbol << " wins!! Whoohooo!!" << endl << endl << endl;
return true;
}
else if( pos1 != "1" && pos2 != "2" && pos3 != "3" && pos4 != "4" && pos5 != "5" && pos6 != "6" && pos7 != "7" && pos8 != "8" && pos9 != "9" )
{
cout << endl << "It's a draw!! Get'em next time." << endl << endl << endl;
return true;
}
else
{
UpdatePlayer(playerSymbol);
return false;
}
}

void SetGameBoardPosition(int posLocation, char playerSymbol, string& pos1, string& pos2, string& pos3, string& pos4, string& pos5, string& pos6, string& pos7, string& pos8, string& pos9)
{
if( posLocation == '1' ) // setting game variable based on the user input value
pos1 = playerSymbol;
else if( posLocation == '2')
pos2 = playerSymbol;
else if( posLocation == '3')
pos3 = playerSymbol;
else if( posLocation == '4')
pos4 = playerSymbol;
else if( posLocation == '5')
pos5 = playerSymbol;
else if( posLocation == '6')
pos6 = playerSymbol;
else if( posLocation == '7')
pos7 = playerSymbol;
else if( posLocation == '8')
pos8 = playerSymbol;
else if( posLocation == '9')
pos9 = playerSymbol;
}

char GetValidUserInput(char playerSymbol, string pos1, string pos2, string pos3, string pos4, string pos5, string pos6, string pos7, string pos8, string pos9)
{
bool validInput = false;
char entry;

while( !validInput)
{
cout << "Enter the location number where you want to place an \"" << playerSymbol << "\": ";
cin >> entry; // getting user input for the board position
if( entry >= '1' && entry <= '9')
{

if( (entry == '1' && pos1 == "1") || (entry == '2' && pos2 == "2") || (entry == '3' && pos3 == "3") ||
(entry == '4' && pos4 == "4") || (entry == '5' && pos5 == "5") || (entry == '6' && pos6 == "6") ||
(entry == '7' && pos7 == "7") || (entry == '8' && pos8 == "8") || (entry == '9' && pos9 == "9") )
{
validInput = true;
}
else
{
cout << "You have entered a position that has already been used. ";
validInput = false;
}
}
else
{
cout << "You have entered an incorrect value. Please enter a number from 1 to 9. ";
}
cout << endl << endl;
}
return entry;
}

void InitializeGame(bool& gameOver, char& playerSymbol, string& pos1, string& pos2, string& pos3, string& pos4, string& pos5, string& pos6, string& pos7, string& pos8, string& pos9)
{
gameOver = false; // initializing game variables
playerSymbol = 'O';
pos1 = "1";
pos2 = "2";
pos3 = "3";
pos4 = "4";
pos5 = "5";
pos6 = "6";
pos7 = "7";
pos8 = "8";
pos9 = "9";
}

void DisplayIntro(void)
{
cout << "**************************************************" << endl;
cout << " Welcome to *" << endl;
cout << " Awesome Tic Tac Toe *" << endl;
cout << " Well, kind of... *" << endl;
cout << "**************************************************" << endl;
cout << endl << endl;
system("pause");
cout << endl << endl;
}

void DisplayGameBoard(string pos1, string pos2, string pos3, string pos4, string pos5, string pos6, string pos7, string pos8, string pos9)
{
cout << " " << pos1 << " | " << pos2 << " | " << pos3 << endl; // displaying the initial game board
cout << "----------" << endl;
cout << " " << pos4 << " | " << pos5 << " | " << pos6 << endl;
cout << "----------" << endl;
cout << " " << pos7 << " | " << pos8 << " | " << pos9 << endl;
cout << endl;
}

void DisplayCredits(void)
{
cout << endl << endl;
cout << "************* CREDITS *************" << endl; // displaying the game credits
cout << " Designer: Me *" << endl;
cout << " Programmer: Me *" << endl;
cout << " Art Production: Me *" << endl;
cout << " Everything Else: All Me *" << endl;
cout << "*************************************" << endl;
cout << endl << endl;
system("pause");
}

And here is what I have to do to it:

1. Remove the pos1 through pos9 variables and replace them with an array of char containing 9 elements.
2. Modify the affected functions to accept the new array as a parameter and adjust the function code appropriately.
3. In order to handle some type conversion issues you’ll run into, investigate the “atoi” and “itoa” functions.

Any help would be greatly appreciated.
If you want help, ask a clear, short question and post only the relevant code.
Where are you having problems?

1. Remove the pos1 through pos9 variables and replace them with an array of char containing 9 elements.

You mean array of std::string, since pos1..9 are strings?
1
2
3
4
5
6
string pos[9];

pos[0] == pos1;
pos[1] == pos2;
// ...
pos[8] == pos9;


2. Modify the affected functions to accept the new array as a parameter and adjust the function code appropriately.
1
2
3
4
void affectedFunction(string pos[9])
{
    // ...
}


3. In order to handle some type conversion issues you’ll run into, investigate the “atoi” and “itoa” functions.
itoa() isn't standard. And since you're using std::strings instead of C strings char[], you might as well make one more step forward and look into string streams.
http://cplusplus.com/reference/sstream/

int main(void) is archaic.

And, please use code tags, which preserve indentation and have syntax highlighting.
Very sorry about that I'm new here and am in a rush because this has to be submitted by midnight. I am in over my head here and have no idea what half of these instructions mean so sorting this out is proving to be difficult. What I gave you if exactly what my professor gave me without any instruction so you can see my problem.
Topic archived. No new replies allowed.