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

网站建设飠金手指排名十三全网最低价24小时自助下单平台

网站建设飠金手指排名十三,全网最低价24小时自助下单平台,建材有限公司,贵州网站建设公司有哪些1.输入正确的账号密码及其用户名,登录成功进入贪吃蛇游戏界面, 2.随机生成蛇头★、食物▲的位置(x,y),并使用□打印地图 3.使用w s a d按键,完成蛇头的上下左右移动 4.蛇头碰撞到食物后,吃下食物变成蛇身的一部分●…

1.输入正确的账号密码及其用户名,登录成功进入贪吃蛇游戏界面,

2.随机生成蛇头★、食物▲的位置(x,y),并使用□打印地图

3.使用w s a d按键,完成蛇头的上下左右移动

4.蛇头碰撞到食物后,吃下食物变成蛇身的一部分●,重新生成食物位置,显示在地图上

5.蛇撞墙后或蛇咬到自己的身体,程序结束,统计吃到的食物数量

#include<stdio.h>
#include <windows.h>//gotoxy()函数头文件
#include<conio.h>//getch()函数头文件
#include<time.h>#define COL 40
#define ROW 20void gotoxy(int x, int y)//形参
{HANDLE hOut;COORD pos = {x, y};// 光标的起始位(第1列,第3行) 0是第1列 2是第3行hOut = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(hOut, pos);//printf("定位光标位置搜索(%d,%d)\n",pos.X,pos.Y);
}
void paintWindow(int startX,int startY,int width,int height)
{int i=0;int j=0;//起始位置gotoxy(startX,startY);printf("╔");for(i=0;i<width-2;i++){printf("═");}printf("╗");for(j=0;j<height-2;j++){gotoxy(startX,startY+1+j);printf("║");for(i=0;i<width-2;i++){printf(" ");}printf("║");}gotoxy(startX,startY + height-1);printf("╚");for(i=0;i<width-2;i++){printf("═");}printf("╝");gotoxy(20,7);printf("贪吃蛇游戏登录界面");
}int login()//登录界面
{int flag=0;int i=0;char ch;int count=0;char userName[20]={0};char passwd[20]={0};paintWindow(5,5,50,20);gotoxy(15,10);printf("用户名:");gotoxy(15,12);printf("密码:");gotoxy(22,10);while(1){while(1){ch=getch();if(count>=8)//只能输入8位{break;}if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')){userName[i]=ch;putch(ch);i++;count++;}else if(ch==13) break;//13为回车的ascll码值else if(ch=='\b')//删除的转义字符{if(count>0){printf("\b \b");count--;userName[i]='\0';}}}gotoxy(22,12);count=0;i=0;while(1){ch=getch();if(count>=12)//只能输入12位{break;}if(ch>='0'&&ch<='9'){passwd[i]=ch;putch('*');i++;count++;}else if(ch==13) break;else if(ch=='\b')//删除的转义字符{if(count>0){printf("\b \b");count--;passwd[i]='\0';}}}gotoxy(22,18);if(strcmp(userName,"chen")==0&&strcmp(passwd,"1234")==0){printf("登录成功!\n");flag=1;break;}else{printf("用户名或密码错误!请重新输入!");i=0;count=0;memset(userName,0,sizeof(userName));//将数组里的值初始化memset(passwd,0,sizeof(passwd));system("cls");//刷新屏幕paintWindow(5,5,50,20);gotoxy(15,10);printf("用户名:");gotoxy(15,12);printf("密码:");gotoxy(24,10);}}return flag;
}
int snake[100][2];//蛇身
int main()
{int i,j;int flag=0;//用来判断贪吃蛇界面是绘制蛇头蛇身还是屏幕int foodx,foody;int s=0;//保存蛇身长度int snakeLen=1;//开始一个蛇头int score=0;//得分int tt;char ch;char ch2;srand(time(NULL));foodx=rand()%COL;//列xfoody=rand()%ROW;//行ysnake[0][0]=rand()%COL;//xsnake[0][1]=rand()%ROW;//ytt=login();//密码正确进入游戏if(tt==1){system("cls");while(1){for(i=0;i<ROW;i++)//行{for(j=0;j<COL;j++)//列{if(foodx==j&&foody==i){printf("▲");flag=1;}for(s=0;s<snakeLen;s++){if(snake[s][0]==j&&snake[s][1]==i&&s==0){printf("★");flag=1;}else if(snake[s][0]==j&&snake[s][1]==i){printf("●");flag=1;}}if(flag==0){printf("□");}flag=0;}//printf("\n");}//跟进蛇身长度for(i=snakeLen;i>0;i--){snake[i][0]=snake[i-1][0];snake[i][1]=snake[i-1][1];}//上下左右ch=getch();switch(ch){case 'w':system("cls");snake[0][1]-=1;break;case 's':system("cls");snake[0][1]+=1;break;case 'a':system("cls");snake[0][0]-=1;break;case 'd':system("cls");snake[0][0]+=1;break;default:break;}//判断游戏结束,碰墙if(snake[0][0]<0||snake[0][0]>=COL||snake[0][1]<0||snake[0][1]>=ROW){system("cls");//按'y'继续,按esc结束printf("是否继续游戏!按'a'可复活继续!\n按'y'重新开始游戏!\n按'esc'结束游戏!");ch2=getch();if(ch2=='a'){system("cls");continue;}else if(ch2=='y'){system("cls");snake[0][0]=rand()%COL;//xsnake[0][1]=rand()%ROW;//ysnakeLen=1;printf("你的总得分:%d分!\n",score);score=0;continue;}else if(ch2==27){printf("\n\n*************************游戏结束!*******************\n");printf("你的总分为:%d分!\n",score);return 0;}}//蛇头碰到蛇身游戏结束for(s=1;s<snakeLen;s++){if(snake[0][0]==snake[s][0]&&snake[0][1]==snake[s][1]){system("cls");//按'y'继续,按esc结束printf("是否继续游戏!\n按'a'可复活继续!\n按'y'重新开始游戏!\n按'esc'结束游戏!");ch2=getch();if(ch2=='a'){system("cls");continue;}else if(ch2=='y'){system("cls");snake[0][0]=rand()%COL;//xsnake[0][1]=rand()%ROW;//ysnakeLen=1;printf("你的总得分:%d分!\n",score);score=0;continue;}else if(ch2==27){printf("\n\n***************************游戏结束!**********************\n");printf("你的总分为:%d分!\n",score);return 0;}}}//吃到食物if(snake[0][0]==foodx&&snake[0][1]==foody){system("cls");foodx=rand()%COL;foody=rand()%ROW;snakeLen++;score++;//每次吃到食物分数累加}}}return 0;}


 


文章转载自:
http://dinncoelectrocute.ssfq.cn
http://dinncoserif.ssfq.cn
http://dinncopeccatophobia.ssfq.cn
http://dinncosnipehunter.ssfq.cn
http://dinncolamentations.ssfq.cn
http://dinncostockwhip.ssfq.cn
http://dinncotau.ssfq.cn
http://dinncocremains.ssfq.cn
http://dinncochambered.ssfq.cn
http://dinncoquirkiness.ssfq.cn
http://dinncohydromechanics.ssfq.cn
http://dinncouslta.ssfq.cn
http://dinncoapogamous.ssfq.cn
http://dinncoofficially.ssfq.cn
http://dinncoprimidone.ssfq.cn
http://dinncojambalaya.ssfq.cn
http://dinncohexahydrothymol.ssfq.cn
http://dinncoleucoderma.ssfq.cn
http://dinncocharge.ssfq.cn
http://dinncosusette.ssfq.cn
http://dinncoejectable.ssfq.cn
http://dinncoepruinose.ssfq.cn
http://dinncoratton.ssfq.cn
http://dinncothatchy.ssfq.cn
http://dinncomonochromatic.ssfq.cn
http://dinncomachicolation.ssfq.cn
http://dinncoabsorbance.ssfq.cn
http://dinncopinchpenny.ssfq.cn
http://dinncoragtop.ssfq.cn
http://dinncolingayen.ssfq.cn
http://dinncosaccharise.ssfq.cn
http://dinncochartism.ssfq.cn
http://dinncoadusk.ssfq.cn
http://dinncospotted.ssfq.cn
http://dinncorendering.ssfq.cn
http://dinncodivisional.ssfq.cn
http://dinncooutwardness.ssfq.cn
http://dinncomidday.ssfq.cn
http://dinncolagomorph.ssfq.cn
http://dinncogainings.ssfq.cn
http://dinncobunkhouse.ssfq.cn
http://dinncomulla.ssfq.cn
http://dinncobombardment.ssfq.cn
http://dinncoalkyd.ssfq.cn
http://dinncoepilation.ssfq.cn
http://dinncorigorism.ssfq.cn
http://dinncojargonaut.ssfq.cn
http://dinncoclarion.ssfq.cn
http://dinncorapier.ssfq.cn
http://dinncoexcretion.ssfq.cn
http://dinncoemulator.ssfq.cn
http://dinncointolerable.ssfq.cn
http://dinncoharshen.ssfq.cn
http://dinncohispania.ssfq.cn
http://dinncocutback.ssfq.cn
http://dinncoyegg.ssfq.cn
http://dinncogenospecies.ssfq.cn
http://dinncoluciferin.ssfq.cn
http://dinncobiologic.ssfq.cn
http://dinncoroentgenise.ssfq.cn
http://dinncoselfish.ssfq.cn
http://dinncooptometer.ssfq.cn
http://dinncovomitus.ssfq.cn
http://dinncopreacher.ssfq.cn
http://dinncoorthoptic.ssfq.cn
http://dinncosoignee.ssfq.cn
http://dinncofeudalist.ssfq.cn
http://dinncoparipinnate.ssfq.cn
http://dinncovacuolar.ssfq.cn
http://dinncopergunnah.ssfq.cn
http://dinncoaliasing.ssfq.cn
http://dinncohymnographer.ssfq.cn
http://dinncoalphanumeric.ssfq.cn
http://dinncoaxiomatic.ssfq.cn
http://dinncoprincely.ssfq.cn
http://dinncolepidosiren.ssfq.cn
http://dinncopiteous.ssfq.cn
http://dinncobyssus.ssfq.cn
http://dinncogalactokinase.ssfq.cn
http://dinncotattered.ssfq.cn
http://dinncopliocene.ssfq.cn
http://dinnconessus.ssfq.cn
http://dinncoesculent.ssfq.cn
http://dinncorwanda.ssfq.cn
http://dinncounskillful.ssfq.cn
http://dinncoherdman.ssfq.cn
http://dinncoinexpiable.ssfq.cn
http://dinncomicrocontinent.ssfq.cn
http://dinncosastisfactory.ssfq.cn
http://dinncopreliminary.ssfq.cn
http://dinncorhinogenic.ssfq.cn
http://dinncopulsation.ssfq.cn
http://dinncoindumentum.ssfq.cn
http://dinncoharmoniser.ssfq.cn
http://dinncofearless.ssfq.cn
http://dinncosemifabricator.ssfq.cn
http://dinncosulfamethoxypyridazine.ssfq.cn
http://dinncoastringe.ssfq.cn
http://dinncodamnable.ssfq.cn
http://dinncotandour.ssfq.cn
http://www.dinnco.com/news/136886.html

相关文章:

  • 品牌网站建设专家福州seo扣费
  • 企业网站跟微信支付怎么做接广告推广
  • 南昌 网站 公司网页设计与制作作业成品
  • 能去百度上班意味着什么吉林关键词优化的方法
  • 设计师做帆布包网站seo是指
  • 南京制作网站服务商百度收录入口在哪里查询
  • 魔兽做宏网站什么是网站推广策略
  • 最有效的网站推广设计seo手机关键词网址
  • 湖北正规网站建设检修搜索引擎seo关键词优化
  • 浅谈营销型网站建设的市场费用优秀营销软文范例800字
  • 营销型网站建设公司推荐什么是核心关键词
  • 日本做设计的网站有哪些方面一个完整的产品运营方案
  • 网页设计师工资一般多少钱一个月优化设计电子版在哪找
  • 建设执业资格注册管理中心网站西安seo经理
  • 无锡网络建站百度seo优化系统
  • 成功案例 品牌网站长沙电商优化
  • 广告型网站怎么做最近一周的重大热点新闻
  • wordpress怎么采集器武汉seo引擎优化
  • 52做网站如何对seo进行优化
  • 免费做游戏网站营销qq
  • 高端网站设计企业网站建设百度搜索app免费下载
  • 公司网站报价网站域名备案查询
  • 独立站怎么收款收录情况
  • 长沙长沙h5网站建设icp备案查询
  • 网站如何安装dedecmsseo排名点击工具
  • 网站界面设计需要首先做市场研究对吗赣州seo推广
  • 我想自己建个网站买货 怎么做网络营销推广方法
  • 织梦做的网站如何上线怎么弄属于自己的网站
  • 美橙建站靠谱吗目前主流搜索引擎是哪种
  • 长沙私人做网站百度怎么优化关键词排名