C 開發小遊戲 掃雷

2021-09-24 17:56:42 字數 1909 閱讀 1565

**如下:

/*

* to change this license header, choose license headers in project properties.

* to change this template file, choose tools | templates

* and open the template in the editor.

*//* 

* file:   main.cpp

* author: administrator

** created on 2023年4月29日, 上午10:06

*/#include

#include

#include

#include

#include

#include

#include

#include

#define a 17

#define b 17 

#define c 30

using namespace std

//定義全域性變數

dword a,b;

char map[a][b],news,spare;

int boomtotalnums,floatx,floaty,flag[a][b],flagnum,mode,slect[a][b],game;

//顏色屬性

const word fore_blue = foreground_blue;

const word fore_green = foreground_green;

const word fore_red = foreground_red;

//開墾地圖結構體

struct node;

queue dui;

//列印位置

void position(int x,int y);

handle out = getstdhandle(std_output_handle);

setconsolecursorposition(out,pos);

};//隱藏游標

void hide()

//初始化

void beginning()

game = 1;

floatx = a/2;

floaty = b/2;

flagnum = 0;

boomtotalnums = c;

mode = 0;

handle handle_out = getstdhandle(std_output_handle); //獲得標準輸出裝置控制代碼

console_screen_buffer_info csbi; //定義視窗緩衝區資訊結構體

getconsolescreenbufferinfo(handle_out,&csbi); //獲得視窗緩衝區資訊

int x,y;

srand((unsigned)time(0));

for(int i = 0;i//列印地圖一小部分

void lump(int xx,int yy)

else printf("");

}else

break;

case '@' :

if(xx == floatx && yy == floaty)

else printf("");

}else

break;

case 'x' : 

if(floatx == xx && floaty == yy) printf(""); 

else printf("  ");

break;    //已經挖開的空白}}

//移動游標

void move()

C 小遊戲 掃雷

標頭檔案 define crt secure no warnings 1 ifndef game h define game h include include include include define row 9 define col 9 define rows row 2 define co...

c 小遊戲 掃雷

include include include include include include includeusing namespace std define maxn 35 define midx 10 define midy 40 define cg 25 define ck 80 int ...

c 小遊戲 掃雷

include include include include include include includeusing namespace std define maxn 35 define midx 10 define midy 40 define cg 25 define ck 80 int ...