1 Replies - 475 Views - Last Post: 09 October 2012 - 08:20 AM Rate Topic: -----

#1 devonrevenge   User is offline

  • New D.I.C Head

Reputation: -10
  • View blog
  • Posts: 22
  • Joined: 08-October 12

do you know why my tic tac toe board wont update?

Posted 09 October 2012 - 08:17 AM

So im trying to get the program to give the chars abcdefgh and i the value of either an X or a O, only it remains blank!!


#include <iostream>
#include <string>

using namespace std;

char a,b,c,d,e,f,g,h,i,j;// so these represent the empty spaces in getbrd
char x = 'X';
char o = 'O';// these are what i want to replace the empty spaces with                  
string name;
string name2;
char brdlog [3] [3];// im not using this yet
void getbrdstart ();//this is just the display to start with
void getbrd ();
int input;
void plyr1 ();//the function that usees a switch statment to replace spaces in                 \\getbrd


int main ()

{
getbrdstart ();

cout << "TIC TAC TOE BY DEVONREVENGE\n"<<endl;

cout << "player 1 enter your name..."<<endl;
cin >> name;
cout << "player 2 enter your name..."<<endl;
cin >>name2;
plyr1 ();
getbrd ();



return 0;
}

void getbrd ()
{
cout << a << "|" << b << "|" << c<<endl;
cout << "-"<< "+" << "-" << "+"<< "-"<<endl;
cout << d<<"|"<<e<<"|"<< f <<endl;
  cout << "-"<< "+" << "-" << "+"<< "-"<<endl;
cout << g<<"|"<<h<<"|"<< i <<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"<< endl;

}

void getbrdstart ()
{
cout << "1" << "|" << "2" << "|" << "3"<<endl;
cout << "-"<< "+" << "-" << "+"<< "-"<<endl;
cout << "4"<<"|"<<"5"<<"|"<< "6" <<endl;
  cout << "-"<< "+" << "-" << "+"<< "-"<<endl;
cout << "7"<<"|"<<"8"<<"|"<< "9\n \n" <<endl;
}


void plyr1 ()
{
cout << name << "input number to place your O"<<endl;
cin >> input;
switch (input)
{
case '1':
a=o;
break;
case '2':
b=o;
break;
case '3':
c=o;
break;
case '4':
d=o;
break;
case '5':
e=o;
break;
case '6':
f=o;
break;
case '7':
g=o;
break;
case '8':
h=o;
break;
case '9':
i=o;
break;
}
}



Is This A Good Question/Topic? 0
  • +

Replies To: do you know why my tic tac toe board wont update?

#2 jimblumberg   User is offline

  • member icon

Reputation: 5916
  • View blog
  • Posts: 17,932
  • Joined: 25-December 09

Re: do you know why my tic tac toe board wont update?

Posted 09 October 2012 - 08:20 AM

Please don't open duplicate topics. Topic closed.

Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1