any one can help me hw to write tic tac toe program using visual studio...

http://www.daniweb.com/forums/announcement8-2.html

Sure, but first you need to
- make an attempt
- post what you tried
- ask a proper question about what is going wrong, or what to do next.

But if you insist on cheating your way through college, then perhaps this will help.
http://clusty.com/search?query=tic+tac+toe+source+code&sourceid=Mozilla-search
Assuming you don't get found out all through college (or your college simply doesn't care about cheats), then you're good.
That is, until you land your first job and your new employer finds your 'degree' is only worth wiping your arse with, you get blacklisted as a fraud, and your only hope of paying off your student debts is to pull 20hr shifts at the local burger joint.

Just don't waste anyone elses time by pretending otherwise on forums such as this.

hmm ok thanx for the advise.. btw im a student

#include <iostream>
#include <string>


using namespace std;
enum SquareState
{
(blank = 's',
X = 'X',
0 ='0')
};
class gameBoard
{
private:
const int WIDTH;
const int HEIGHT;
int* GameBoard;
public:
gameBoard(): WIDTH(3), HEIGHT(3)
{
GameBoard = new int [9];
for (int i = 0; i < 9; i++)
*(GameBoard + i) = blank;
}
~gameBoard() {delete[] GameBoard;}
void setX(int h, int w);
void set0(int h, int w);
bool isTaken(int h, int w);
SquareState isLine();
void draw();
};


void gameBoard::setX(int h, int w)
{
*(GameBoard + h*HEIGHT + w)=X;
}
void gameBoard::set0(int h, int w)
{
*(GameBoard + h*HEIGHT + w)=0;
}


bool gameBoard::isTaken(int h, int w)
{
return *(GameBoard + h*HEIGHT + w)!= '';
}
SquareState gameBoard::isLine()
{
if (*GameBoard==X && *(GameBoard +1)==X && *(GameBoard +2)==X)
return X;
if (*GameBoard==0 && *(GameBoard +1)==0 && *(GameBoard +2)==0)
return 0;
if (*GameBoard +3)==X && *(GameBoard +4)==X && *(GameBoard +5)==X)
return X;
if (*GameBoard +3)==0 && *(GameBoard +4)==0 && *(GameBoard +5)==0)
return 0;
if (*GameBoard +6)==X && *(GameBoard +7)==X && *(GameBoard +8)==X)
return X;
if (*GameBoard +6)==X && *(GameBoard +7)==X && *(GameBoard +8)==X)
return 0;


if (*GameBoard==X && *(GameBoard +4)==X && *(GameBoard +8)==X)
return X;
if (*GameBoard==0 && *(GameBoard +4)==0 && *(GameBoard +8)==0)
return 0;
if (*GameBoard +2)==X && *(GameBoard +4)==X && *(GameBoard +6)==X)
return X;
if (*GameBoard +2)==0 && *(GameBoard +4)==0 && *(GameBoard +6)==0)
return 0;
return blank;
}
void gameBoard::draw()
{
cout<<endl;
for(int i=0; i < HEIGHT; i++)
{
cout << (char)*(GameBoard + i*HEIGHT);
for(int c=1; c < WIDTH; c++)
cout<< " | "<<(char)*(GameBoard + i*WIDTH + c);
cout << endl << "------------"<<endl;
}
}
class Game
{
public:
gameBoard* doInput(string player, gameBoard* gb);
bool inRange(int test);
};
gameBoard* Game::doInput(std::string player, gameBoard *gb)
{
gb->draw();


string letter;
if (player.compare("one")==0)
letter= "X";
else if (player.compare("two")==0)
letter= "0";
else return gb;
int input1, input2;
do{
do{

can u tell me wats the problem

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.