diff --git a/进入界面.cpp b/进入界面.cpp new file mode 100644 index 0000000..7bd8048 --- /dev/null +++ b/进入界面.cpp @@ -0,0 +1,113 @@ +#include +#include +#include +void welcome(); +int color(int c) +{ + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),c);//ɫ + return 0; +} +/*****ȡĻλ*******/ +static void gotoxy(int x, int y){ +COORD point = { x, y };//Ҫõλx,y +HANDLE HOutput = GetStdHandle(STD_OUTPUT_HANDLE);//ʹGetStdHandle(STD_OUTPUT_HANDLE)ȡ׼ľ +SetConsoleCursorPosition(HOutput, point);//ùλ +} +//ɽ +void title() +{ + color(14); + gotoxy(30,7); + printf("ӭ"); + color(5); + gotoxy(36,8); + printf("ԹϷ"); +} +void ajsm() +{ + int n; + color(8); + gotoxy(30,9); + printf("̡"); + gotoxy(30,10); + printf("12˳:[ ](س)\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); + scanf("%d",&n); + switch(n) + { + case 1: + system("cls"); + welcome(); + break; + case 2: + exit(0); + } + +} +void yxgz() +{ + int n; + color(2); + gotoxy(30,9); + printf("Сܿϰյɣ"); + gotoxy(30,10); + printf("12˳:[ ](س)\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); + scanf("%d",&n); + switch(n) + { + case 1: + system("cls"); + welcome(); + break; + case 2: + exit(0); + } + +} +void welcome() +{ + title(); + int i,j=1; + color(9); + for(i=9;i<=20;i++){ + for(j=15;j<=60;j++){ + gotoxy(j,i); + if(i==9||i==20) printf("="); + else if(j==15||j==59) printf("::"); + } + } + int n; + color(12); + gotoxy(25,12); + printf("1.ʼϷ"); + gotoxy(40,12); + printf("2.˵"); + gotoxy(25,17); + printf("3.Ϸ"); + gotoxy(40,17); + printf("4.˳"); + gotoxy(21,22); + printf("ѡ[1,2,3,4]:[ ](س)\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); + scanf("%d",&n); + switch(n) + { + case 1: + system("cls"); + break; + case 2: + system("cls"); + ajsm(); + break; + case 3: + system("cls"); + yxgz(); + break; + case 4: + exit(0); + break; + } +} +int main(void) +{ + welcome(); + return 0; + } diff --git a/进入界面.exe b/进入界面.exe new file mode 100644 index 0000000..5fc7418 Binary files /dev/null and b/进入界面.exe differ diff --git a/迷宫随机地图.cpp b/迷宫随机地图.cpp deleted file mode 100644 index f70040f..0000000 --- a/迷宫随机地图.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -#include -#include -#include -#include -#define Height 25 //Թĸ߶ȣΪ -#define Width 25 //ԹĿȣΪ -#define Wall 1 -#define Road 0 -#define Start 2 -#define End 3 -int map[Height+2][Width+2]; -void gotoxy(int x,int y) //ƶ -{ -COORD coord; -coord.X=x; -coord.Y=y; -SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), coord ); -} -void create(int x,int y) //Թ -{ -int c[4][2]={0,1,1,0,0,-1,-1,0}; //ĸ -int i,j,t;// -for(i=0;i<4;i++) -{ -j=rand()%4; -t=c[i][0];c[i][0]=c[j][0];c[j][0]=t; -t=c[i][1];c[i][1]=c[j][1];c[j][1]=t; -} -map[x][y]=Road; -for(i=0;i<4;i++) -if(map[x+2*c[i][0]][y+2*c[i][1]]==Wall) -{ -map[x+c[i][0]][y+c[i][1]]=Road; -create(x+2*c[i][0],y+2*c[i][1]); -} -} -void paint(int x,int y) //Թ -{ -gotoxy(2*y-2,x-1); -switch(map[x][y]) -{ -case Start: -printf("");break; // -case End: -printf("");break; // -case Wall: -printf("~");break; //ǽ -case Road: -printf(" ");break; //· -} -} -int main() -{ -system("title ԹϷ"); -int i,j; -srand((unsigned)time(NULL)); //ʼ漴 -for(i=0;i<=Height+1;i++) -for(j=0;j<=Width+1;j++) -if(i==0||i==Height+1||j==0||j==Width+1) //ʼԹ -map[i][j]=Road; -else map[i][j]=Wall; -create(2*(rand()%(Height/2)+1),2*(rand()%(Width/2)+1)); //һ㿪ʼԹõжΪż -for(i=0;i<=Height+1;i++) //߽紦 -{ -map[i][0]=Wall; -map[i][Width+1]=Wall; -} -for(j=0;j<=Width+1;j++) //߽紦 -{ -map[0][j]=Wall; -map[Height+1][j]=Wall; -} -map[2][1]=Start; // -map[Height-1][Width]=End; // -for(i=1;i<=Height;i++) -for(j=1;j<=Width;j++) //Թ -paint(i,j); -return 0; -} diff --git a/迷宫随机地图.exe b/迷宫随机地图.exe deleted file mode 100644 index 186ad0c..0000000 Binary files a/迷宫随机地图.exe and /dev/null differ