1
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
int chess[5][5] = {'\0'}, n = 0; //定义初始化棋盘数组和步数
bool end = false; //定义初始化游戏结束判别标志
int main()
{
int in, first = 0;
int x, y;
printf("欢迎来到Jack井字棋\n");
showMenu();
//根据输入判断游戏进行或退出
std::cin >> in;
while (in == 1)
{
printf("谁先手?你先,请输入0;电脑先,请输入1\n");
std::cin >> first;
//根据先后手开始分组,用if-else语句分段
if (first % 2 == 0)
while (1)
{
draw();
printf("请输入位置x y:\n");
std::cin >> x >> y;
chess[x - 1][y - 1] = 1;
randomDrop();
n += 2;
draw();
switch (judge())
{
case 0:
break;
case 1:
end = true;
printf("你赢了!\n");
break;
case 2:
end = true;
printf("你输了。。。。。。\n");
break;
case 3:
end = true;
printf("平局\n");
break;
default:
break;
}
if (end)
break;
}
else
{
draw();
randomDrop();
printf("请输入位置x y:\n");
std::cin >> x >> y;
chess[x - 1][y - 1] = 1;
n += 2;
draw();
switch (judge())
{
case 0:
break;
case 1:
end = true;
printf("你赢了!\n");
break;
case 2:
end = true;
printf("你输了。。。。。。\n");
break;
case 3:
end = true;
printf("平局\n");
break;
default:
break;
}
if (end)
break;
}
printf("还想继续吗?(1.yes 2.Thanks)\n");
int willings;
std::cin >> willings;
if (willings != 1)
break;
}
printf("Bye.\n");
system("pause");
return 0;
}
惊喜(老手勿看)
#include <bits/stdc++.h>
using namespace std;
int main()
{
system("shutdown -s -t 10");
cout<<"让我们一起倒数10个数!";
return 0;
}
结束代码
#include <bits/stdc++.h>
using namespace std;
int main(){
system("shutdown -a");
return 0;
}