下载此文档

C语言飞机大战源码.docx


文档分类:IT计算机 | 页数:约16页 举报非法文档有奖
1/16
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/16 下载此文档
文档列表 文档介绍
#include<iostream>#include<>#include<>#include<>#include<string>usingnamespacestd;/*===============allthestructures===============*/typedefstructFrame{ COORDposition[2]; intflag;}Frame;/*===============allthefunctions===============*/voidSetPos(COORDa)//setcursor{ HANDLEout=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(out,a);}voidSetPos(inti,intj)//setcursor{ COORDpos={i,j}; SetPos(pos);}voidHideCursor(){ CONSOLE_CURSOR_INFOcursor_info={1,0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);}//把第y行,[x1,x2)之间的坐标填充为chvoiddrawRow(inty,intx1,intx2,charch){ SetPos(x1,y); for(inti=0;i<=(x2-x1);i++) cout<<ch;}//在a,b纵坐标相同的前提下,把坐标[a,b]之间填充为chvoiddrawRow(COORDa,COORDb,charch){ if(==) drawRow(,,,ch); else { SetPos(0,25); cout<<"errorcode01:无法填充行,因为两个坐标的纵坐标(x)不相等"; system("pause"); }}//把第x列,[y1,y2]之间的坐标填充为chvoiddrawCol(intx,inty1,inty2,charch){ inty=y1; while(y!=y2+1) { SetPos(x,y); cout<<ch; y++; }}//在a,b横坐标相同的前提下,把坐标[a,b]之间填充为chvoiddrawCol(COORDa,COORDb,charch){ if(==) drawCol(,,,ch); else { SetPos(0,25); cout<<"errorcode02:无法填充列,因为两个坐标的横坐标(y)不相等"; system("pause"); }}//左上角坐标、右下角坐标、用row填充行、用col填充列voiddrawFrame(COORDa,COORDb,charrow,charcol){ drawRow(,+1,,row); drawRow(,+1,,row); drawCol(,+1,,col); drawCol(,+1,,col);}voiddrawFrame(intx1,inty1,intx2,inty2,charrow,charcol){ COORDa={x1,y1}; COORDb={x2,y2}; drawFrame(a,b,row,col);}voiddrawFrame(Frameframe,charrow,charcol){ COORDa=[0]; COORDb=[1]; drawFrame(a,b,row,col);}voiddrawPlaying(){ drawFrame(0,0,48,24,'=','|');// drawmapframe; drawFrame(49,0,79,4,'-','|');// drawoutputframe drawFrame(49,4,79,9,'-','|');// drawscoreframe drawFrame(49,9,79,20,'-','|');// drawoperateframe drawFrame(49,20,79,24,'-','|');// drawothermessageframe SetPos(52,6); cout<<"得分:"; SetPos(52,7); cout<<"称号:"; SetPos(52,10); cout<<"操作方式:"; SetPos(52,12); cout<<"a,s,d,w控制战机移动。"; SetPos(52,14); cout<<"p暂停游戏。"; SetPos(52,16); cout<<"e退出游戏。";}//在[a,b)之间产生一个随机整数intrandom(inta,intb){ intc=(rand()%(a-b))+a; returnc;}//在两个坐标包括的矩形框内随机产生

C语言飞机大战源码 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数16
  • 收藏数0 收藏
  • 顶次数0
  • 上传人梅花书斋
  • 文件大小15 KB
  • 时间2020-02-15