linux使用gcc实现扫雷,基于linux环境下扫雷应用程序.doc

基于linux环境下扫雷应用程序

《网络操作系统》报告

(应用程序开发)

题 目: 基于linux平台GCC环境下扫雷应用程 序开发 姓 名: 李磊 学 院: 理学院 专 业: 网络工程 班 级: 092 学 号: 1887090211 2012 年 01月 01 日

基于Linux平台GCC环境下扫雷应用程序开发

1 应用程序功能

通过模拟windows系统中的扫雷应用程序,在linux平台gcc环境下实现C语言扫雷应用程序。

2 硬件平台

内存2.0G,硬盘320G,CPU Pentium 4以上PC机一台

3 软件平台

3.1 操作系统平台

linux cygwin环境

3.2 应用软件平台(黑体小四号)

Visual C++ 6.0或其他C语言编译程序,linux cygwin环境,GCC编译条件

3.3 应用程序

// header file

#include

#include

#include

#include

#include

// defines

#define KEY_UP 0xE048

#define KEY_DOWN 0xE050

#define KEY_LEFT 0xE04B

#define KEY_RIGHT 0xE04D

#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

// Strings Resource

#define STR_GAMETITLE "程序说明: 数字键1打开 \

数字键2标记 数字键3打开附近盒子"

#define STR_GAMEWIN "亲,祝贺你赢了哦,再接再厉哦!\n"

#define STR_GAMEOVER "亲,你咋那么笨呢?挂了吧!\n"

#define STR_GAMEEND " 亲,按 ESC 键退出程序\n"

//-------------------------------------------------------------

// Base class

class CConsoleWnd

{

public:

static int TextOut(const char*);

static int GotoXY(int, int);

static int CharOut(int, int, const int);

static int TextOut(int, int, const char*);

static int GetKey();

public:

};

//{{// class CConsoleWnd

//

// int CConsoleWnd::GetKey()

// Wait for standard input and return the KeyCode

//

int CConsoleWnd::GetKey()

{

int nkey=getch(),nk=0;

if(nkey>=128||nkey==0)nk=getch();

return nk>0?nkey*256+nk:nkey;

}

//

// int CConsoleWnd::GotoXY(int x, int y)

// Move cursor to (x,y)

// Only Console Application

//

int CConsoleWnd::GotoXY(int x, int y)

{

COORD cd;

cd.X = x;cd.Y = y;

return SetConsoleCursorPo

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值