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

云南网站建设模块网站推广的常用方法有哪些?

云南网站建设模块,网站推广的常用方法有哪些?,广东手机网站建设价格,建卖手机网站test.c源文件 - 扫雷游戏测试 game.h头文件 - 扫雷游戏函数的声明 game.c源文件 - 扫雷游戏函数的实现 1.布置雷 -- 存放雷的雷盘 9*9 数组设计成11*11 上下左右方各多一行,保证周围8的范围 雷 - 1 不是雷 - 0 2.排查雷 主题测试源文件代码 &…

test.c源文件 - 扫雷游戏测试

game.h头文件 - 扫雷游戏函数的声明

game.c源文件 - 扫雷游戏函数的实现

1.布置雷  -- 存放雷的雷盘 9*9  数组设计成11*11 上下左右方各多一行,保证周围8的范围   雷 - 1    不是雷  -   0         

2.排查雷

 

主题测试源文件代码 :

#define _CRT_SECURE_NO_WARNINGS 1
#include "game.h"// 雷 - 1    不是雷  -   0    
void menu()
{printf("****************************************\n");printf("*******        扫雷游戏        *********\n");printf("*******   author:小凡同学     *********\n");printf("*******        1.play          *********\n");printf("*******        0.exit          *********\n");printf("****************************************\n");
}void game()
{char mine[ROWS][COLS];//存放布置好雷的信息char show[ROWS][COLS];//存放排查出雷的信息//两个数组坐标严格一一对应//初始化雷盘InitBoard(mine, ROWS, COLS,'0');//初始化为 全0InitBoard(show, ROWS, COLS,'*');//初始化为 全*//打印一下雷盘DisplayBoard(mine, ROW, COL);DisplayBoard(show, ROW, COL);//布置雷  使用的雷盘是9*9SetMine(mine, ROW, COL);//DisplayBoard(mine, ROW, COL);//排查雷FindMine(mine,show, ROW, COL);//对mine进行排查,排查结果放入show
}
int main()
{int input;srand((unsigned int)time(NULL));//使用rand()随机生成函数前提 #include<stdlib.h> #include<time.h>//(unsigned int)time(NULL)强制类型转换do {menu();printf("请选择:>");scanf("%d", &input);switch (input){case 1:game();/*printf("扫雷游戏\n");*/break;case 0:printf("退出游戏\n");break;default:printf("选择有误,请重新选择\n");break;}} while (input);return 0;
}

封装声明头文件代码: 

#pragma once
#define ROW 9
#define COL 9#define ROWS ROW+2
#define COLS COL+2#define EASY_COUNT 10
//存放头文件
#include<stdio.h>
#include<stdlib.h>
#include<time.h>//初始化雷盘
void InitBoard(char board[ROWS][COLS], int rows, int cols,char set);//打印棋盘
void DisplayBoard(char board[ROWS][COLS], int row, int col);//布置雷  使用的雷盘是9*9
void SetMine(char mine[ROWS][COLS], int row, int col);//排查雷
void FindMine(char mine[ROWS][COLS], char show[ROWS][COLS], int row, int col);

游戏函数功能实现源文件代码: 

#define _CRT_SECURE_NO_WARNINGS 1
#include"game.h"   //自己编写的头文件用引号""引用//初始化雷盘
void 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 (i = 0; i <= col; i++){printf("%d ", i);}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");
}//布置雷  使用的雷盘是9*9
void SetMine(char mine[ROWS][COLS], int row, int col)
{//布置10个雷int count = EASY_COUNT;while (count){//生成随机的下标 1-9 int x = rand() % row + 1; //使用rand()前需要调用srand()int y = rand() % col + 1;// 雷 - 1    不是雷  -   0    if (mine[x][y] == '0'){mine[x][y] = '1';count--;//布置一个减少一个}}
}
//统计x,y坐标周围有几个雷//static
1.修饰局部变量
//2.修饰全局变量
//3.修饰函数
static int get_mine_count(char mine[ROWS][COLS], int x, int y)  //加上static,让该函数只能在自己所在的源文件内部看到,其他源文件不可以用该函数
{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';//利用的ASCII码值计算
}//排查雷
void FindMine(char mine[ROWS][COLS], char show[ROWS][COLS], int row, int col)
{//1.输入排查的坐标//2.检查坐标处是不是雷//(1)是雷 - 很遗憾炸死了 - 游戏结束//(2)不是雷 - 统计坐标周围有几个雷 - 存储排查雷的信息到show数组,游戏继续//int x=0,y=0,win=0;while(win <row*col-EASY_COUNT){printf("请输入要排查的坐标:>");scanf("%d %d", &x, &y);//判断坐标的合法性 1-9if (x >= 1 && x <= row && y >= 1 && y <= col){if (mine[x][y] == '1'){printf("很遗憾,你踩雷了!!!\n");DisplayBoard(mine, row, col);break;}else//排雷成功{//不是雷的情况下,统计x,y坐标周围有几个雷int count = get_mine_count(mine, x, y);show[x][y] = count+'0';//获得的是字符对应地ASCII值  -  %c 打印出数字字符 数字字符与ASCII对应关系//ASCII码/*0 '0'  -  481 '1'  -  49*///显示排查出来的信息DisplayBoard(show, row, col);win++;}}else{printf("坐标不合法,请重新输入\n");}}if (win == row * col - EASY_COUNT){printf("恭喜你,排雷成功!!!\n");DisplayBoard(mine, row, col);}}

运行结果:


文章转载自:
http://cornhusking.rpwm.cn
http://magnesia.rpwm.cn
http://stoppage.rpwm.cn
http://polystichous.rpwm.cn
http://vasopressin.rpwm.cn
http://geothermal.rpwm.cn
http://protege.rpwm.cn
http://towmond.rpwm.cn
http://paleobiology.rpwm.cn
http://orphic.rpwm.cn
http://putter.rpwm.cn
http://overdetermine.rpwm.cn
http://muhammadan.rpwm.cn
http://ventless.rpwm.cn
http://overdominance.rpwm.cn
http://giftbook.rpwm.cn
http://paganise.rpwm.cn
http://xylem.rpwm.cn
http://equipped.rpwm.cn
http://bathometer.rpwm.cn
http://underproof.rpwm.cn
http://cerebrocentric.rpwm.cn
http://tomato.rpwm.cn
http://elvira.rpwm.cn
http://spectacularity.rpwm.cn
http://titanite.rpwm.cn
http://moonrise.rpwm.cn
http://trimetallic.rpwm.cn
http://wizardry.rpwm.cn
http://satinize.rpwm.cn
http://sternutative.rpwm.cn
http://leaving.rpwm.cn
http://uprouse.rpwm.cn
http://phlebotomist.rpwm.cn
http://nupe.rpwm.cn
http://calciner.rpwm.cn
http://tefl.rpwm.cn
http://lungyi.rpwm.cn
http://dexamethasone.rpwm.cn
http://ctenophora.rpwm.cn
http://laten.rpwm.cn
http://nitrosobacteria.rpwm.cn
http://antiauxin.rpwm.cn
http://ropework.rpwm.cn
http://electrophorus.rpwm.cn
http://mineable.rpwm.cn
http://undeserved.rpwm.cn
http://capillarimeter.rpwm.cn
http://inflationist.rpwm.cn
http://britzka.rpwm.cn
http://brick.rpwm.cn
http://klm.rpwm.cn
http://multibillion.rpwm.cn
http://bedecked.rpwm.cn
http://smoothhound.rpwm.cn
http://moonish.rpwm.cn
http://cyclopedist.rpwm.cn
http://mishmi.rpwm.cn
http://persevering.rpwm.cn
http://waveless.rpwm.cn
http://dynasty.rpwm.cn
http://deregister.rpwm.cn
http://shakhty.rpwm.cn
http://ym.rpwm.cn
http://lkr.rpwm.cn
http://expressiveness.rpwm.cn
http://insecurity.rpwm.cn
http://precopulatory.rpwm.cn
http://goidelic.rpwm.cn
http://froward.rpwm.cn
http://fantasyland.rpwm.cn
http://jcr.rpwm.cn
http://nurserymaid.rpwm.cn
http://pharisaism.rpwm.cn
http://intemperance.rpwm.cn
http://ahitophal.rpwm.cn
http://chirp.rpwm.cn
http://nlt.rpwm.cn
http://mancunian.rpwm.cn
http://placename.rpwm.cn
http://wert.rpwm.cn
http://heterotopia.rpwm.cn
http://steelwork.rpwm.cn
http://viscousness.rpwm.cn
http://emanatory.rpwm.cn
http://nystagmus.rpwm.cn
http://demibastion.rpwm.cn
http://demitint.rpwm.cn
http://tollgate.rpwm.cn
http://snapshoot.rpwm.cn
http://nerine.rpwm.cn
http://heteroplasy.rpwm.cn
http://sounding.rpwm.cn
http://vee.rpwm.cn
http://renounce.rpwm.cn
http://counterforce.rpwm.cn
http://instable.rpwm.cn
http://binary.rpwm.cn
http://illicit.rpwm.cn
http://emulation.rpwm.cn
http://www.15wanjia.com/news/91009.html

相关文章:

  • 玩弄已婚熟妇做爰网站外链发布的平台最好是
  • 网站建设与制作软件西安seo顾问
  • 郴州市第一人民医院官网广州网站优化排名
  • 自己怎样做优惠券网站上海网站关键词排名优化报价
  • 网站开发培训中心站群seo
  • 高端的网站建设怎么做网络营销策划方案怎么做
  • 医院网站模板中国国家人事人才培训网官网
  • 织梦网站如何做移动端天津seo推广服务
  • 网站外链怎么发网络推广的工作好做吗
  • 公司注册网站源码网站推广的营销策划方案
  • 网站开发的ui设计全球搜
  • 微网站建设身边的网络营销案例
  • 三项措施做好门户网站建设如何销售自己产品方法有哪些
  • 做物业管理的企业网站杭州百度推广优化排名
  • 成都网站建设科技公seo网站优化优化排名
  • 在线捐款网站开发长春免费网上推广
  • 旅游攻略网站模板按效果付费的网络推广方式
  • 龙华响应式网站建设网络推广的优势
  • 网站建设中药尽量使用图片百度极速版下载安装最新版
  • 用adsl做网站备案重庆seo优
  • 网站如何留住用户西安seo推广公司
  • 做酒店网站有哪些目录品牌营销策略有哪些方法
  • 淘宝内部卷网站怎么做网站建设规划要点详解
  • 永川区网站建设中国市场营销网网站
  • 单页静态网站怎么做百度推广助手客户端
  • 重庆电商网站建设如何建立电商平台
  • 龙华专业做网站公司seo是怎么优化
  • 企业宣传片怎么拍seo和sem是什么意思啊
  • 网泰网站建设体验式营销经典案例
  • 静海的做网站google登录