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 60 61
|
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string pos = "012345678";
int move;
string letter = "x";
for(int i = 1;i<9;i++)
{
cout << pos << endl;
cout << "Your move is: ";
cin >> move;
if(move == 0)
{
pos.replace(0,1,letter);
}
if(move == 1)
{
pos.replace(1,1,letter);
}
if(move == 2)
{
pos.replace(2,2,letter);
}
if(move == 3)
{
pos.replace(3,3,letter);
}
if(move == 4)
{
pos.replace(4,4,letter);
}
if(move == 5)
{
pos.replace(5,5,letter);
}
if(move == 6)
{
pos.replace(6,6,letter);
}
if(move == 7)
{
pos.replace(7,7,letter);
}
if(move == 8)
{
pos.replace(8,8,letter);
}
cout << pos << endl;
}
return 0;
}
|