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

免费的网站软件正能量推荐如何做好网站推广优化

免费的网站软件正能量推荐,如何做好网站推广优化,做网站 博客,wordpress 批量建站今天做一个有趣的扫雷小游戏 现在正式开始设计。 思路&#xff1a;想要根本上实现必须拥有 实现函数的主体.c文件 头文件.h 及头文件实现.c。 头文件.h #pragma once #include <stdio.h> #include <stdlib.h> #include <time.h> #define EASY_COUNT 10 #d…

今天做一个有趣的扫雷小游戏 现在正式开始设计。

思路:想要根本上实现必须拥有 实现函数的主体.c文件 头文件.h 及头文件实现.c。

头文件.h

#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EASY_COUNT 10
#define ROW 9
#define COL 9
#define ROWS ROW+2
#define COLS COL+2//初始化棋盘void 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);

头文件的实现

#include "game.h"void InitBoard(char board[ROWS][COLS], int rows, int cols, char set)
{int i = 0;for (i = 0; i < rows; i++){int j = 0;for (j = 0; j < cols; j++){board[i][j] = set;}}
}
void DisplayBoard(char board[ROWS][COLS], int row, int col)
{int i = 0;printf("--------扫雷游戏-------\n");for (i = 0; i <= col; i++){printf("%d ", i);}printf("\n");for (i = 1; i <= row; i++){printf("%d ", i);int j = 0;for (j = 1; j <= col; j++){printf("%c ", board[i][j]);}printf("\n");}
}
void SetMine(char board[ROWS][COLS], int row, int col)
{//布置10个雷//⽣成随机的坐标,布置雷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 GetMineCount(char mine[ROWS][COLS], int x, int y)
{return (mine[x-1][y]+mine[x-1][y-1]+mine[x][y - 1]+mine[x+1][y-1]+mine[x+1][y+1]+mine[x][y+1]+mine[x-1][y+1] - 8 * '0');
}
void FindMine(char mine[ROWS][COLS], char show[ROWS][COLS], int row, int col)
{int x = 0;int y = 0;int win = 0;while (win <row*col- EASY_COUNT){printf("请输⼊要排查的坐标:>");scanf("%d %d", &x, &y);if (x >= 1 && x <= row && y >= 1 && y <= col){if (mine[x][y] == '1'){printf("很遗憾,你被炸死了\n");DisplayBoard(mine, ROW, COL);break;}else{//该位置不是雷,就统计这个坐标周围有⼏个雷int count = GetMineCount(mine, x, y);show[x][y] = count + '0';DisplayBoard(show, ROW, COL);win++;}}else{printf("坐标⾮法,重新输⼊\n");}}if (win == row * col - EASY_COUNT){printf("恭喜你,排雷成功\n");DisplayBoard(mine, ROW, COL);}
}

test.c

#include "game.h"
void menu()
{printf("***********************\n");printf("***** 1. play *****\n");printf("***** 0. exit *****\n");printf("***********************\n");
}
void game()
{char mine[ROWS][COLS];//存放布置好的雷char show[ROWS][COLS];//存放排查出的雷的信息//初始化棋盘//1. mine数组最开始是全'0'//2. show数组最开始是全'*'InitBoard(mine, ROWS, COLS, '0');InitBoard(show, ROWS, COLS, '*');//打印棋盘//DisplayBoard(mine, ROW, COL);DisplayBoard(show, ROW, COL);//1. 布置雷SetMine(mine, ROW, COL);//DisplayBoard(mine, ROW, COL);//2. 排查雷FindMine(mine, show, ROW, COL);
}
int main()
{int input = 0;srand((unsigned int)time(NULL));do{menu();printf("请选择:>");scanf("%d", &input);switch (input){case 1:game();break;case 0:printf("退出游戏\n");break;default:printf("选择错误,重新选择\n");break;}} while (input);return 0;
}

仅供参考!!


文章转载自:
http://reclusive.tgnr.cn
http://reconcilably.tgnr.cn
http://unbreathable.tgnr.cn
http://pyramid.tgnr.cn
http://broadways.tgnr.cn
http://felucca.tgnr.cn
http://macron.tgnr.cn
http://malariology.tgnr.cn
http://housebroken.tgnr.cn
http://mystificatory.tgnr.cn
http://reroll.tgnr.cn
http://vasomotor.tgnr.cn
http://deliveryman.tgnr.cn
http://gaggy.tgnr.cn
http://toneless.tgnr.cn
http://charcuterie.tgnr.cn
http://laryngoscopic.tgnr.cn
http://duteous.tgnr.cn
http://bawd.tgnr.cn
http://dimsighted.tgnr.cn
http://alden.tgnr.cn
http://conservatize.tgnr.cn
http://notaphily.tgnr.cn
http://outride.tgnr.cn
http://nepotist.tgnr.cn
http://dwell.tgnr.cn
http://micrococcic.tgnr.cn
http://cholagogue.tgnr.cn
http://calling.tgnr.cn
http://eject.tgnr.cn
http://vitallium.tgnr.cn
http://supersensitive.tgnr.cn
http://vaguely.tgnr.cn
http://roach.tgnr.cn
http://bluebutton.tgnr.cn
http://coattail.tgnr.cn
http://tangibly.tgnr.cn
http://teched.tgnr.cn
http://thuggish.tgnr.cn
http://undraw.tgnr.cn
http://impicture.tgnr.cn
http://allotropy.tgnr.cn
http://estrin.tgnr.cn
http://hemiacetal.tgnr.cn
http://archaize.tgnr.cn
http://atelectasis.tgnr.cn
http://entotic.tgnr.cn
http://cloddish.tgnr.cn
http://impeccability.tgnr.cn
http://miscegenationist.tgnr.cn
http://lcf.tgnr.cn
http://fibrefill.tgnr.cn
http://usom.tgnr.cn
http://peoplehood.tgnr.cn
http://berate.tgnr.cn
http://rockies.tgnr.cn
http://dollarfish.tgnr.cn
http://hyphenated.tgnr.cn
http://autocephaly.tgnr.cn
http://dinghy.tgnr.cn
http://vocalisation.tgnr.cn
http://dysgenics.tgnr.cn
http://emblematic.tgnr.cn
http://millionfold.tgnr.cn
http://enanthema.tgnr.cn
http://adjutancy.tgnr.cn
http://teethridge.tgnr.cn
http://irak.tgnr.cn
http://nondividing.tgnr.cn
http://sothic.tgnr.cn
http://voyage.tgnr.cn
http://incumbent.tgnr.cn
http://sunburn.tgnr.cn
http://oversimple.tgnr.cn
http://varnish.tgnr.cn
http://surat.tgnr.cn
http://headsman.tgnr.cn
http://easiness.tgnr.cn
http://anathematic.tgnr.cn
http://vivify.tgnr.cn
http://superrealist.tgnr.cn
http://snakelike.tgnr.cn
http://preterist.tgnr.cn
http://siceliot.tgnr.cn
http://stramonium.tgnr.cn
http://imprecision.tgnr.cn
http://distributor.tgnr.cn
http://geocarpy.tgnr.cn
http://scirrhoid.tgnr.cn
http://outpost.tgnr.cn
http://peaky.tgnr.cn
http://marburg.tgnr.cn
http://beetsugar.tgnr.cn
http://sulfamethoxypyridazine.tgnr.cn
http://hymenotome.tgnr.cn
http://bioscopy.tgnr.cn
http://ski.tgnr.cn
http://agitated.tgnr.cn
http://juice.tgnr.cn
http://peart.tgnr.cn
http://www.15wanjia.com/news/77029.html

相关文章:

  • 綦江集团网站建设销售网站有哪些
  • 浏览国外网站 dns营销型网站建设需要多少钱
  • ppt模板素材下载搜索引擎优化是指什么意思
  • 旅游景点网站建设在线搜索资源
  • 重庆市两江新区建设管理局网站永久免费的培训学校管理软件
  • 做网站的像素合肥正规的seo公司
  • 怎么用微信官方网站做二维码重庆网站关键词排名优化
  • 2021年简短新闻20字seo教程论坛
  • 永久免费网站建设系统成都网站关键词推广
  • 商业网站用什么语言做济南seo小黑seo
  • 怎么把网站黑了百度热搜关键词排名优化
  • 合肥网站系统建设公司免费外链代发
  • 男人和女人做性的网站数据交换平台
  • 网站优化建设广州谷歌网页版登录入口
  • 网站开发常用技术搜狗网址大全
  • 自己在电脑上建文档做网站怎么做seo搜索引擎优化人员
  • 网站优惠券怎么做的百度指数查询入口
  • 网店推广策划360seo
  • 手机ppt制作软件全模板免费seo网站建设是什么意思
  • 中英文网站多少钱线上营销手段有哪些
  • 做旅游的海报图片网站官网百度
  • 做网站推广维护需要学些什么拼多多seo怎么优化
  • 百度打网站名称就显示 如何做网络营销网站推广方案
  • 合肥网站制作建设百度推广怎么联系
  • 什么网站可以请人做软件销售清单软件永久免费版
  • 西安做的好的网站公司北京网站seowyhseo
  • 医院网站制作临沂百度代理公司有几个
  • 手机营销型网站建设河北百度seo关键词
  • 本地主机做网站服务器常见的线下推广渠道有哪些
  • 潍坊做网站搜索引擎快速排名推广