1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include <iostream>
#include <string>
#include <iomanip>
class Tic
{
private:
int turn;
char position[3][3];
int status;
public:
Tic();
void drawboard();
void checkstatus();
void changeturn(int);
};
using namespace std;
int main()
{
Tic player;
player.drawboard();
system("PAUSE");
return 0;
}
Tic::Tic(): turn(0),status(0)
{
position[0,0]='x';
position[0,1]='x';
position[0,2]='x';
position[1,0]='x';
position[1,1]='x';
position[1,2]='x';
position[2,0]='x';
position[2,1]='x';
position[2,2]='x';
}
void Tic::drawboard()
{
cout<<" | | \n"
<<" "<<position[0,0]<<" | "<<position[0,1]<<" | "<<position[0,2]<<endl
<<" | | \n"
<<" ---------- ----------- -----------\n"
<<" | | \n"
<<" "<<position[1,0]<<" | "<<position[1,1]<<" | "<<position[1,2]<<endl
<<" | | \n"
<<" ---------- ----------- -----------\n"
<<" | | \n"
<<" "<<position[2,0]<<" | "<<position[2,1]<<" | "<<position[2,2]<<endl
<<" | | \n";
}
|