I am a little stuck with a game I am working on anmd this is not neccessary but I like to try and outdo myself if possible, I fail a lot I am looking at how you would set up so that if 2 players inputed their names it said hi player 1 it is your turn and vice a versa. I have a little code here and if somebody can help that is all good but it is mainly for fun now.
Code:
void playerNames(){ //players can enter their names
cout<<"\t\t"<<"Player One enter name you are X:"; cin>>name1; "\n";
cout<<"\t\t"<<"Player Two enter name you are O:"; cin>>name2; "\n";
}
void playGame(){
symbol='X','O';
playerNames();
do
{
do
{
displayBoard();//dispays board for each turn
cout<<"\n\n"<< name1 <<" choose a column to place your go:";// instructs user to take their go
cin>>column;
system("cls");// refreshes screen once x takes their go, refreshes upon each new go.
if (column<1 || column>7)
cout <<"\n"<<"that is an invaild choice choose 1-7"<<"\n";//if a column less than 1 or more than 7 is chosen the error message is outputted to the screen
}
while (column<1 || column>7);
column--;
i=0;
while ((gameArray[i][column]=='X' || gameArray[i][column]=='O') && i<7)//if one of the game array slots is equal to X or O
i++;
if (i<7)
{
gameArray[i][column]=symbol;
count++;
if (symbol=='X')//symbol is set to start as always X then O goes
symbol='O';
else symbol='X';
}
else cout <<"\n"<<"column is full please try another"<<"\n";
}