#include <iostream>
#include <cstdlib>
#include <windows.h>
using namespace std;
int main()
{
string tab[3][3];
for(int i=0; i<3; i++)
{
tab[i][0]="-";
tab[i][1]="-";
tab[i][2]="-";
}
int tura=0;
for(;;)
{
if(tura%2==0) cout<<"Gracz 1 = X\n";
else cout<<"Gracz 2 = O\n";
cout<<" "<<tab[0][0]<<" "<<tab[1][0]<<" "<<tab[2][0]<<" "<<endl;
cout<<" "<<tab[0][1]<<" "<<tab[1][1]<<" "<<tab[2][1]<<" "<<endl;
cout<<" "<<tab[0][2]<<" "<<tab[1][2]<<" "<<tab[2][2]<<" "<<endl;
int x,y;
cout<<"Ktory znak zmienic: ";
cin>>x;
cin>>y;
if((x==1||x==2||x==3)&&(y==1||y==2||y==3))
{
if(tab[x-1][y-1]=="-")
{
if(tura%2==0) tab[y-1][x-1]="X";
else tab[y-1][x-1]="O";
tura++;
}
else
{
cout<<"To miejsce jest zajete!"<<endl;
Sleep(1500);
}
}
else
{
cout<<"Podales zle dane!";
Sleep(1500);
}
system("cls");
}
return 0;
}