第一范文网 - 专业文章范例文档资料分享平台

C编写的扫雷源程序

来源:用户分享 时间:2025/5/30 21:25:41 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

C编写的扫雷源程序

集团企业公司编码:(LL3698-KKI1269-TM2483-LUI12689-ITT289-

//headerfile

#include #include #include #include #include //defines

#defineKEY_UP0xE048 #defineKEY_DOWN0xE050 #defineKEY_LEFT0xE04B #defineKEY_RIGHT0xE04D #defineKEY_ESC0x001B #defineKEY_1'1' #defineKEY_2'2' #defineKEY_3'3'

#defineGAME_MAX_WIDTH100 #defineGAME_MAX_HEIGHT100 //StringsResource

#defineSTR_GAMETITLE\ Key2:MarkKey3:OpenNeighbors\

#defineSTR_GAMEWIN\\

#defineSTR_GAMEOVER\ #defineSTR_GAMEEND\

//------------------------------------------------------------- //Baseclass classCConsoleWnd { public:

staticintTextOut(constchar*); staticintGotoXY(int,int);

staticintCharOut(int,int,constint); staticintTextOut(int,int,constchar*); staticintGetKey(); public: };

//{{//classCConsoleWnd //

//intCConsoleWnd::GetKey()

//WaitforstandardinputandreturntheKeyCode //

intCConsoleWnd::GetKey()

{

intnkey=getch(),nk=0;

if(nkey>=128||nkey==0)nk=getch(); returnnk>0nkey*256+nk:nkey; } //

//intCConsoleWnd::GotoXY(intx,inty) //Movecursorto(x,y) //OnlyConsoleApplication //

intCConsoleWnd::GotoXY(intx,inty) { COORDcd; cd.X=x;cd.Y=y;

returnSetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),cd); } //

//intCConsoleWnd::TextOut(constchar*pstr) //Outputastringatcurrentposition //

intCConsoleWnd::TextOut(constchar*pstr)

{

for(;*pstr;++pstr)putchar(*pstr); return0; } //

//intCConsoleWnd::CharOut(intx,inty,constintpstr) //Outputacharat(x,y) //

intCConsoleWnd::CharOut(intx,inty,constintpstr) {

GotoXY(x,y);

returnputchar(pstr); } //

//intCConsoleWnd::TextOut(constchar*pstr) //Outputastringat(x,y) //

intCConsoleWnd::TextOut(intx,inty,constchar*pstr) {

GotoXY(x,y);

returnTextOut(pstr); }

搜索更多关于: C编写的扫雷源程序 的文档
C编写的扫雷源程序.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c3ld24883us7916095eiv3gyk618jsm00823_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top