掃雷小遊戲

2021-08-20 10:50:10 字數 1277 閱讀 4442

#include

#include

#include

#include

#include

#define rows 11 //行數

#define cols 11 //列數

#define leicount 10 //雷數

int dir[8][2]=;

int menu();//選單函式

void display(char show[rows][cols]);//列印下棋完了顯示的介面

int game(char mine[rows][cols],char show[rows][cols]);//遊戲

void set_mine(char mine[rows][cols]);//設定雷的位置

int sweep(char mine[rows][cols], char show[rows][cols]);//開始掃雷

int get_num(char mine[rows][cols], int x, int y);//計算雷的個數

int main()

}menu();

while (1)

else if (input == 0)

else

printf("\n輸入有誤!請重新輸入:");

}return 0;

}//起始選單

int menu()

//設定雷的位置

void set_mine(char mine[rows][cols])

}//下面兩行是指令碼,哈哈哈。

//display(mine);

//system("pause");

}//列印下棋完了顯示的介面

void display(char show[rows][cols])

}//計算雷的個數

int get_num(char mine[rows][cols], int x, int y)

return count;

}//開始掃雷

int sweep(char mine[rows][cols], char show[rows][cols])

else

}display(mine);

printf(" 恭喜你贏了!\n");

return 0;

}//遊戲

int game(char mine[rows][cols],char show[rows][cols])

小遊戲 掃雷

c語言實現的乙個簡單的掃雷遊戲 介面簡單,功能 首次踩雷的,會換雷。掃雷有九宮格擴撒 環境 vs2015 如下 game.h pragma once ifndef game h define game h define rows 11 define cols 11 define num 9 incl...

小遊戲 掃雷

實現乙個掃雷遊戲 1.設定兩個陣列 mine row col 表示布雷,show row col 顯示掃雷情況 顯示周圍有幾個雷 因為統計四周,邊緣位置不好實現,所以把二維陣列的行和列都加二,這樣無論是否在邊緣都可以當做一種情況來實現。2.初始化mine和show,show mine 0 3.set...

掃雷小遊戲

game.h 標頭檔案 ifndef game h define game h include include include include define row 12 define col 12 define count 10 棋盤中雷的總數 extern char show mine row ...