五子棋

#include <bits/stdc++.h>
#include <Windows.h>
using namespace std;
int HENG=16,SHU=16;
int IS_WIN=false;
int ALL[16][16];
void f5(){
	system("cls");
	cout<<"  ";
	for(int i=0;i<HENG;i++){
		cout<<setw(3)<<i+1;
	}
	cout<<endl;
	for(int i=0;i<HENG;i++){
		cout<<setw(3)<<i+1;
		for(int j=1;j<SHU;j++){
			if(ALL[i][j]==1){
				cout<<setw(3)<<"1";
			}else if(ALL[i][j]==2){
				cout<<setw(3)<<"0";
			}else{
				cout<<setw(3)<<".";
			}
		}
		cout<<endl;
	}
}
int main(){ 
	//1.刷新棋盘 
	f5();
	int x,y;
	while(IS_WIN==false){
		cout<<"黑棋下:";//1
		cin>>x>>y;
		ALL[x][y]=1;
		f5();
		
		cout<<"白棋下:";//2
		cin>>x>>y;
		ALL[x][y]=2;
		f5();
	}
	return 0;
}

  

posted @ 2023-11-05 09:31  最后一个还有我  阅读(16)  评论(0)    收藏  举报