文档介绍:《网络操作糸统》报告
(应用程序开发丿
题 目: 基于I inux平台GCC环境下扫雷应用程
序开发
姓 名: 全篡
学 院: 理学院
专 业: 网络工程
班 级: 092
学 号: 18870902"
2012年 01月01日
基于L i nux平台GCC环境下扫雷应用程序开发
1应用程序功能
通过模拟windows系统中的扫雷应用程序,在linux平台gcc环境下实现C语言
扫雷应用程序。
2硬件平台
,硬盘320G, CPU Pentium 4以上PC机一台 3软件平台
3. 1操作系统平台
linux cygwin 环境
3. 2应用软件平台(黑体小四号)
Visual C++ ,1 inux cygwin环境,GCC编译条件
// header file
#incIude <iostream>
#i nc 丨 ude <cstdI i b>
#incIude 〈ctime>
# i nc 丨 ude <wi >
#incIude〈>
// defines
#define KEY_UP 0xE048
#define KEY_DOWN 0xE050
#define KEY_LEFT OxEO4B
#define KEY RIGHT OxEO4D
#define KEY ESC 0x001B
#define KEY_1
'1'
#define KEY_2
'2'
#define KEY_3
'3'
#define GAME_MAX.
_WIDTH 100
#define GAME MAX
HEIGHT 100
// Str i ngs Resource
#define STR_GAMET I TLE "程序说明: 数字键1打开\
数字键2标记 数字键3打开附近盒子"
#define STR_GAMEWIN "亲,祝贺你赢了哦,再接再厉哦!\n
#define STR_GAMEOVER "亲,你咋那么笨呢?挂了吧!\n"
#define STR_GAMEEND "亲,按 ESC 键退出程序\n"
//■
// Base cI ass
cI ass CConsoIeWnd
pub lie:
stat i c
int
TextOut (const char*);
stat i c
int
GotoXY (i nt,
int);
stat i c
int
CharOut (i nt,
i nt,
const
int);
stat i c
int
TextOut (i nt,
i nt,
const
char*)
stat i c
int
GetKey ();
pub lie:
};
//{{// cI ass CConsoIeWnd
//
// i nt CConso I eWnd: : GetKey ()
// Wa i t for standard i nput and return the KeyCode
//
i nt CConso I eWnd: : GetKey ()
{
i nt nkey二getch (), nk=0;
i f (nkey>=1281 | nkey=0) nk=getch (); return nk>0?nkey*256+nk:nkey;
}
//
// i nt CConsoIeWnd::GotoXY (i nt x, i nt y)
// Move cursor to (x, y)
// On Iy Conso Ie AppI i cat i on
//
i nt CConsoIeWnd::GotoXY (i nt x, i nt y)
{
COORD cd;
cd. X 二 x; cd. Y = y;
return
SetConsoIeCursorPos i t i on (GetStdHandIe (STD_OUTPUT_HANDLE), cd);
}
//
// i nt CConsoIeWnd::TextOut (const char* pstr)
// Output a str i ng at current pos i tion
//
int CConso IeWnd::TextOut (const char* pstr)
{
for(;*pstr;++pstr) putchar(*pstr);
return 0;
//
// i