C语言飞机大战源码#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,-1,row); drawRow(,+1,-1,row); drawCol(,+1,-1,col); drawCol(,+1,-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
C语言飞机大战源码 来自淘豆网m.daumloan.com转载请标明出处.