当前位置: 首页 > news >正文

织梦 网站标题中国化工建设网站

织梦 网站标题,中国化工建设网站,网站左侧悬浮导航,义网站建设推荐郑国华按照教程打完了。好几个bug都是自己打出来的。比如统计周围8个格子时#xff0c;有一个各自加号填成了减号。我还以为平移了#xff0c;一会显示是0一会显示是2。结果单纯的打错了。debug的时候断点放在scanf后面会顺畅一些。中间多放一些变量名方便监视。以及mine要多显示有一个各自加号填成了减号。我还以为平移了一会显示是0一会显示是2。结果单纯的打错了。debug的时候断点放在scanf后面会顺畅一些。中间多放一些变量名方便监视。以及mine要多显示在测试的时候。虽然成品是show但是拿成品测试累死个人 test.c #define _CRT_SECURE_NO_WARNINGS#include game.hvoid menu() {printf(------------------------------------\n); printf(---------- 1.play ----------------\n);printf(---------- 2.exit ----------------\n);printf(------------------------------------\n);printf(------------------------------------\n);//记得换行符 }void game() {//存放布置的雷char mine[ROWS][COLS] { 0 };//存放排查出的雷char show[ROWS][COLS] { 0 };Initboard(mine, ROWS, COLS, 0);Initboard(show, ROWS, COLS, *);setmine(mine, ROW, COL);Displayboard(show, ROW, COL);findmine(mine, show, ROW, COL);/*Displayboard(mine, ROW, COL);Displayboard(show, ROW, COL);*/}int main() {//初始化int input 0;srand((unsigned int)time(NULL));//生成随机数的最简步骤有哪些do{menu();printf(请选择:);scanf(%d, input);switch(input){case 1:game();//printf(扫雷\n);break;case 2:printf(退出游戏\n);break;default:printf(错误选择\n);break;}} while (input 2 ? 0 : input);return 0; } game.c #define _CRT_SECURE_NO_WARNINGS #include game.hvoid Initboard(char board[ROWS][COLS], int rows, int cols, char set) {int i, j;for (i 0; i rows; i){for (j 0; j cols; j){board[i][j] set;}} }void Displayboard(char board[ROWS][COLS], int row, int col) {int i 0;int j 0;printf(---------- 扫雷游戏 -----------\n);//记得换行符for (j 0; j col; j){printf(%d , j);}printf(\n);for (i 1; i row; i){printf(%d , i);for (j 1; j col; j){printf(%c , board[i][j]);}printf(\n);}printf(---------- 扫雷游戏 -----------\n);//记得换行符 }void setmine(char board[ROWS][COLS], int row, int col) {int count EASY_COUNT;while (count){int x rand() % row 1;int y rand() % col 1;if (board[x][y] 0){board[x][y] 1;count--;}} }int get_mine_count(char board[ROWS][COLS], int x, int y) {int i;i(board[x - 1][y] board[x - 1][y - 1] board[x][y - 1] board[x 1][y - 1] board[x 1][y] board[x 1][y 1] board[x][y 1] board[x - 1][y 1] - 8 * 0);return i; }void findmine(char mine[ROWS][COLS], char show[ROWS][COLS], int row, int col) {int win 0;while (winrow*col-EASY_COUNT){printf(请输入要排查的坐标:);int x 0;int y 0;scanf(%d %d, x, y);if (x 1 x row y 1 y col){if (show[x][y] ! *){printf(排查过了换一个\n);}else{if (mine[x][y] 1){printf(你被炸死了\n);Displayboard(mine, ROW, COL);break;}else{win;//周围几个雷int count get_mine_count(mine, x, y);show[x][y] count 0;//转换为数字字符//Displayboard(mine, ROW, COL);Displayboard(show, ROW, COL);}}}else{printf(请重新输入坐标\n);}}//注意这里条件不要写成赋值了if (win row * col - EASY_COUNT){printf(排雷成功\n);Displayboard(mine, ROW, COL);}} game.h #pragma once #define _CRT_SECURE_NO_WARNINGS #includestdio.h #includetime.h #includestdlib.h //这几个头文件对应的英文意思和内容是什么#define EASY_COUNT 10#define ROW 9 #define COL 9#define ROWS ROW2 #define COLS COL2void Initboard(char board[ROWS][COLS], int rows, int cols, char set); void Displayboard(char board[ROWS][COLS], int row, int col); void setmine(char board[ROWS][COLS], int row, int col); void findmine(char mine[ROWS][COLS], char show[ROWS][COLS], int row, int col); 输出结果 ------------------------------------ ---------- 1.play ---------------- ---------- 2.exit ---------------- ------------------------------------ ------------------------------------ 请选择:1 ---------- 扫雷游戏 ----------- 0 1 2 3 4 5 6 7 8 9 1 * * * * * * * * * 2 * * * * * * * * * 3 * * * * * * * * * 4 * * * * * * * * * 5 * * * * * * * * * 6 * * * * * * * * * 7 * * * * * * * * * 8 * * * * * * * * * 9 * * * * * * * * * ---------- 扫雷游戏 ----------- 请输入要排查的坐标:1 1 ---------- 扫雷游戏 ----------- 0 1 2 3 4 5 6 7 8 9 1 1 * * * * * * * * 2 * * * * * * * * * 3 * * * * * * * * * 4 * * * * * * * * * 5 * * * * * * * * * 6 * * * * * * * * * 7 * * * * * * * * * 8 * * * * * * * * * 9 * * * * * * * * * ---------- 扫雷游戏 ----------- 请输入要排查的坐标:1 2 ---------- 扫雷游戏 ----------- 0 1 2 3 4 5 6 7 8 9 1 1 1 * * * * * * * 2 * * * * * * * * * 3 * * * * * * * * * 4 * * * * * * * * * 5 * * * * * * * * * 6 * * * * * * * * * 7 * * * * * * * * * 8 * * * * * * * * * 9 * * * * * * * * * ---------- 扫雷游戏 ----------- 请输入要排查的坐标:2 1 你被炸死了 ---------- 扫雷游戏 ----------- 0 1 2 3 4 5 6 7 8 9 1 0 0 0 1 0 0 0 0 0 2 1 0 0 0 0 0 0 0 0 3 0 0 0 0 1 0 0 0 1 4 0 0 0 0 0 0 1 0 0 5 0 0 0 0 0 0 0 0 1 6 0 0 0 0 0 0 0 0 0 7 0 1 0 0 0 0 0 0 0 8 1 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 1 1 ---------- 扫雷游戏 ----------- ------------------------------------ ---------- 1.play ---------------- ---------- 2.exit ---------------- ------------------------------------ ------------------------------------ 请选择:2 退出游戏
http://www.hkea.cn/news/14312730/

相关文章:

  • 网站建设公司面临的问题七牛云wordpress加速
  • 无锡网站建设推广公司外贸平台运营
  • 潍坊知名网站建设哪家好展示型装饰网站模板下载
  • 12306 网站开发qq的seo综合查询
  • 网站建设 收费小程序登录入口网页版
  • 企业网站建设方案如何写oa办公系统有哪些
  • 好看的网站源码免费网站建设制作哪家公司好
  • wordpress媒体库整理网站优化 西安
  • 海口网站建设方面网站设计制作公司
  • 我想在泉州做网站只知道网站后台怎么做301
  • 物流网站建设模板下载优秀ppt模板免费下载
  • 住房和建设建设局网站做微信问卷调查的网站
  • 漳州城乡建设局网站首页wordpress 广告文件夹
  • php 网站调试如何下载网站模板文件在哪里
  • 永久的免费网站地址网站维护学习
  • 关于做网站的笑话行情宝app下载
  • 黑龙江骏域建设网站专家某旅行社网站建设论文
  • 开发员给我用织梦做的网站网站充值支付宝收款怎么做
  • sql与网站开发2021热点新闻事件
  • 淄博做网站公司建设银行民营企业
  • 装修网站合作visual composer wordpress.org
  • 做地方房产网站怎么样免费html5网站模板
  • 免费建站建设网站搭建网站建立一个网站需要什么
  • 自己怎么开网站做销售网站文章优化
  • 500强网站设计各地好的深圳影视广告
  • 企业网站seo从哪开始聊城做网站做的不错的
  • 织梦做网站要多长时间绿色建筑网站
  • 网站地图什么意思wordpress怎样修改页脚版权信息
  • 建湖做网站价格西安旅游攻略3天花费
  • 网站优化工作怎么样观影楼网站