Created
March 8, 2018 15:58
-
-
Save pro100skm/3e834d2d599c7c7a21f9edb43814bfd7 to your computer and use it in GitHub Desktop.
For Sarver from my HEART
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
char m[3][3]; | |
for (int i = 0; i < 3; ++i) { | |
for (int j = 0; j < 3; ++j) { | |
a[i][j]='-'; | |
} | |
} | |
for (int i = 0; i < 3; ++i) { | |
for (int j = 0; j < 3; ++j) { | |
cout<<m[i][j]<<" "; | |
} | |
cout<<endl; | |
} | |
int i,j,probel,xC=0; | |
bool nextX = true; | |
while(true){ | |
cin>>i>>j; | |
if(m[i][j]=='-'){ | |
if(nextX){ | |
m[i][j]='x'; | |
nextX=false; | |
}else{ | |
m[i][j]='o'; | |
nextX=true; | |
} | |
}else{ | |
cout<<"Ne chitery!"<<endl; | |
} | |
probel = 0; | |
for (int i = 0; i < 3; ++i) { | |
for (int j = 0; j < 3; ++j) { | |
cout<<m[i][j]<<" "; | |
if(m[i][j]=='-') | |
{ | |
probel++; | |
} | |
} | |
cout<<endl; | |
} | |
if(probel==0){ | |
for (int i = 0; i < 3; ++i) { | |
for (int j = 0; j < 3; ++j) { | |
a[i][j]='-'; | |
} | |
} | |
for (int i = 0; i < 3; ++i) { | |
for (int j = 0; j < 3; ++j) { | |
cout<<m[i][j]<<" "; | |
} | |
cout<<endl; | |
} | |
} | |
for (int i = 0; i < 3; ++i) { | |
for (int j = 0; j < 3; ++j) { | |
if(m[i][j]=='x'){ | |
xC++; | |
} | |
} | |
if(xC==3){ | |
cout<<"Win x"; | |
} | |
xC=0; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment