Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
Add Comment
Please, Sign In to add comment