1 Star 0 Fork 0

yangtong/小游戏

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
saolei小游戏.cpp 1001 Bytes
一键复制 编辑 原始数据 按行查看 历史
yangtong 提交于 2022-01-22 19:05 . 扫雷小游戏
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include "game.h"
using namespace std;
void menu() {
cout << "**********************************" << endl;
cout << "***1.play***0.exit**" << endl;
cout << "**********************************" << endl;
}
void game() {
char mine[ROWS][COLS] = { 0 };
char show[ROWS][COLS] = { 0 };
//1.初始化一个棋盘
intial_board(mine, ROWS, COLS,'0');
intial_board(show, ROWS, COLS, '*');
//2.打印棋盘
//3.布置雷
set_mine(mine, ROW, COL);
show_board(mine, ROW, COL);
show_board(show, ROW, COL);
//4.排雷了
find_mine(mine, show, ROW, COL);
}
int main() {
int input;
srand((unsigned int)time(NULL));//这里调用一次就行了 设置随机数的生成起点 time函数会返回一个时间戳 这个会返回一个随机值 srand要求你要传入一个随机值
do {
menu();
cin >> input;
switch (input)
{
case 1 :
game();
break;
case 0:
cout << "退出游戏" << endl;
break;
default:
cout << "选择错误,请重新选择!!";
break;
}
} while (input);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/spongebobpineapple-house/games.git
git@gitee.com:spongebobpineapple-house/games.git
spongebobpineapple-house
games
小游戏
new_branch

搜索帮助