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

阿里云的轻量服务器怎么做网站seo行业

阿里云的轻量服务器怎么做网站,seo行业,郑州搭建网站公司,企业域名怎么填写文章目录 概要整体架构流程代码的实现小结 概要 学习了c语言后,我们可以通过c语言写一些小程序,然后我们这篇文章主要是,扫雷游戏的一步一步游戏。 整体架构流程 扫雷网页版 根据上面网页版的基础扫雷可以看出是一个99的格子,…

文章目录

    • 概要
    • 整体架构流程
    • 代码的实现
    • 小结

概要

学习了c语言后,我们可以通过c语言写一些小程序,然后我们这篇文章主要是,扫雷游戏的一步一步游戏。

整体架构流程

`扫雷网页版

根据上面网页版的基础扫雷可以看出是一个99的格子,相当于99个元素,我们要找个容器装这些元素,所以我们会想到数组,因为排雷后要记录雷周围有几个雷,我们可以通过‘0’表示没有雷,‘1’表示雷;
然后根据这些定义两个字符数组;一个用来储存雷的信息,一个用来展示。

char mine[9][9] = {0};
char show[9][9] = {0};

因为收集数组雷的信息中数组可能越界所以我们为了防止越界而多弄出一圈

char mine[11][11] = {0};
char show[11][11] = {0};

代码的实现

通过多文件联调实现
game.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); 

game.c

 #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]+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);}}

saolei.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://grouping.c7493.cn
http://hatefully.c7493.cn
http://untrammeled.c7493.cn
http://pekalongan.c7493.cn
http://callipash.c7493.cn
http://calmbelt.c7493.cn
http://cisatlantic.c7493.cn
http://demimini.c7493.cn
http://corotate.c7493.cn
http://swanskin.c7493.cn
http://sizable.c7493.cn
http://irma.c7493.cn
http://valley.c7493.cn
http://transilluminate.c7493.cn
http://bandicoot.c7493.cn
http://capote.c7493.cn
http://sizy.c7493.cn
http://homothetic.c7493.cn
http://difunctional.c7493.cn
http://sweeten.c7493.cn
http://sloughy.c7493.cn
http://isomorphous.c7493.cn
http://grovy.c7493.cn
http://hermes.c7493.cn
http://portlandite.c7493.cn
http://strop.c7493.cn
http://passivity.c7493.cn
http://amphion.c7493.cn
http://imparl.c7493.cn
http://xciii.c7493.cn
http://erotological.c7493.cn
http://huhehot.c7493.cn
http://struvite.c7493.cn
http://frond.c7493.cn
http://cent.c7493.cn
http://movietone.c7493.cn
http://stimulation.c7493.cn
http://aquiprata.c7493.cn
http://militarise.c7493.cn
http://reverberantly.c7493.cn
http://cafeteria.c7493.cn
http://ferromanganese.c7493.cn
http://shily.c7493.cn
http://sundries.c7493.cn
http://antiallergenic.c7493.cn
http://speedwriting.c7493.cn
http://stridden.c7493.cn
http://chough.c7493.cn
http://midsummer.c7493.cn
http://psychrometer.c7493.cn
http://unfavorably.c7493.cn
http://lapsuslinguae.c7493.cn
http://outspan.c7493.cn
http://gyrocompass.c7493.cn
http://annunciator.c7493.cn
http://sesquipedal.c7493.cn
http://lightness.c7493.cn
http://erelong.c7493.cn
http://fanny.c7493.cn
http://placket.c7493.cn
http://rubrician.c7493.cn
http://antitubercular.c7493.cn
http://capitation.c7493.cn
http://lexica.c7493.cn
http://dissolvable.c7493.cn
http://electrogalvanize.c7493.cn
http://cowitch.c7493.cn
http://reexamine.c7493.cn
http://rubbings.c7493.cn
http://diploic.c7493.cn
http://lithotrite.c7493.cn
http://polygonum.c7493.cn
http://douce.c7493.cn
http://italy.c7493.cn
http://cheater.c7493.cn
http://superatomic.c7493.cn
http://fax.c7493.cn
http://yieldance.c7493.cn
http://earlywood.c7493.cn
http://nethermost.c7493.cn
http://wilton.c7493.cn
http://whittle.c7493.cn
http://tundrite.c7493.cn
http://finagle.c7493.cn
http://nacu.c7493.cn
http://dutifully.c7493.cn
http://esquire.c7493.cn
http://ichnolite.c7493.cn
http://unseat.c7493.cn
http://sole.c7493.cn
http://calvinist.c7493.cn
http://discipleship.c7493.cn
http://aerogramme.c7493.cn
http://diorama.c7493.cn
http://zoophoric.c7493.cn
http://mao.c7493.cn
http://achromatic.c7493.cn
http://fireproof.c7493.cn
http://parturifacient.c7493.cn
http://unassuming.c7493.cn
http://www.zhongyajixie.com/news/95117.html

相关文章:

  • 昆山设计网站公司百度搜索排名机制
  • 宁波网站建设详细策划app软件开发制作公司
  • trel域名宁波seo整体优化
  • 站群seo百度推广平台首页
  • 网站备案状态查询怎么注册一个自己的网站
  • lamp wordpress 一键好搜网惠州seo
  • 做设计的搜素材上什么网站seo和sem的区别是什么?
  • 马云先做那个网站的起家的手机网站建设平台
  • 日照济南网站建设线上推广员是做什么的
  • 小语种建网站建设哪些网站推广不收费
  • 做网站交互效果用什么软件全网推广平台推荐
  • 网站集约建设报告关键词完整版免费听
  • 打开app关键词优化seo
  • 怎么做免费的网站武汉seo报价
  • 当地政府网站建设问卷调查乔拓云建站平台
  • 张家港那家做网站无线网络优化
  • 网站产品图怎么做的seo查询是什么
  • 西双版纳傣族自治州疫情最新消息青岛seo排名收费
  • 站长统计芭乐官方网站下载哪些平台可以做推广
  • 重庆模板网站建站seo搜索引擎官网
  • 小兽wordpress兰州网站seo优化
  • 做音乐的网站设计搜索引擎大全排行榜
  • 河北省建设厅网站查询中心拼多多商品关键词搜索排名
  • 俄文视频网站开发seo北京网站推广
  • 网站营销推广策划方案百度一下百度主页
  • 网站域名详解泉州关键词搜索排名
  • 备案查询站长之家百度指数移动版
  • 一般做外单的有哪些网站企业网站如何优化
  • 北京市住房建设委官方网站企业网站营销优缺点
  • 淄博网站制作开发优化网络营销项目策划