这是一个小白编写的简单易懂的五子棋程序
本代码采用了二维数组的虚拟棋盘与if条件输出的完美结合,大佬们一眼就可以看出来
欢迎喷子与大佬指点,你们的使我进步
上代码:
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main(){
while(true){
//打印棋盘
int n = 10;
long long s;
cout << "输入您的验证码加enter开始." << endl;
cin >> s;
int arr[10][10];
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
arr[i][j] = 0;
}
}
bool setin = true;//至关重要!!!!
if(s == 10086){
int winner;
//永久运行
bool win = true;
while(true){
cout << " ";
for(int i = 0 ; i < n; i++){
cout << i + 1 << " ";
}
cout << endl;
cout << endl;
for(int i = 0; i < n; i++){//正式打印
if(i >= 9){
cout << i + 1 << " ";
}else{
cout << i + 1 << " ";
}
for(int j = 0; j < n; j++){
if(arr[i][j] == 0){
cout << "O" << " ";
}else if(arr[i][j] == 1){
cout << "*" << " ";
}else{
cout << "@" << " ";
}
}
cout << endl;
}
//最最最最最重要的部分!!!!!!!!!
//判断胜负
int winner;//!!!
for(int i = 0; i < n; i++){
for(int j = 0; j <