Skip to content

Instantly share code, notes, and snippets.

@pro100skm
Created March 8, 2018 15:58
Show Gist options
  • Save pro100skm/3e834d2d599c7c7a21f9edb43814bfd7 to your computer and use it in GitHub Desktop.
Save pro100skm/3e834d2d599c7c7a21f9edb43814bfd7 to your computer and use it in GitHub Desktop.
For Sarver from my HEART
#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