From 3daa7d30348c36343741f15482bcb8cf5ca85b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=9F=8F=E5=BA=AD?= <18408000206@stu.hut.edu.cn> Date: Sun, 13 Jan 2019 20:33:53 +0800 Subject: [PATCH] first commit --- 迷宫游戏.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 迷宫游戏.cpp diff --git a/迷宫游戏.cpp b/迷宫游戏.cpp new file mode 100644 index 0000000..f60726c --- /dev/null +++ b/迷宫游戏.cpp @@ -0,0 +1,63 @@ +#include +#define Height 25//Թĸ߶ +#define Width 25//ԹĿ +#define Wall 1 +#define Road 0 +#define Start 2 +#define End 3 +#define Esc 5 +#define Up 1 +#define Down 2 +#define Left 3 +#define Right 4 +static int flag=0,hei=0; // +static int a=51,b=5; //'' + +int map[Height+2][Width+2]; +void gotoxy(int x,int y) //ƶ +{ + COORD coord; /*COORDʵһCڲõĽṹ*/ + coord.X=x; + coord.Y=y; //SetConsoleCursorPositionƶģҲCֱṩֱʹþͿԡ + SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), coord ); +} //GetStdHandle(STD_OUTPUT_HANDLE)һ̶ĺʽñ׼ľ +void hidden()//ع +{ + HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); //GetStdHandleҲCڲѾ趨õģֱӵþС + CONSOLE_CURSOR_INFO cci; + GetConsoleCursorInfo(hout,&cci); + cci.bVisible=0;//1Ϊʾ0Ϊ + SetConsoleCursorInfo(hout,&cci); +} + + + +int main() +{ + system("color F3"); + out://ͨغԹgoto + int i,j; + char k; + flag=0,hei=0; a=51,b=5; + + system("title ʼһ"); + gotoxy(51,0); + printf("ΰߣʼĩһ̤룬 ޻ףڴеõɶ޵С"); + gotoxy(51,2); + printf("I룿ո~\n II'ESC'~"); + k=getch(); + if(k==' '){ + gotoxy(51,4); + printf("OK~~"); + } + else + { + gotoxy(51,4); + printf("Goodbye"); + return 0; + } + hidden(); //ع + getch(); + return 0; +} +