#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
int main()
{
int i123,ab;
for(i123=500;i123<=1000;i123+=100){
Beep(i123,1000);
}
char a,b,c,d,aa,bb,cc,dd;
cout<<"输入四位字母ID";
cin>>a;
cin>>b;
cin>>c;
cin>>d;
system("cls"); //清屏函数
cout<<"请再次输入四位字母ID";
cin>>aa;
cin>>bb;
cin>>cc;
cin>>dd;
if(a==aa&&b==bb&&c==cc&&d==dd)
{
cout<<"欢迎您"<<aa<<bb<<cc<<dd;
cout<<"您要干什么?[1]游戏[2]退出" ;
cin>>ab;
if(ab==1)
{
system("color 8f");
int i123;
cout<<" ."<<endl;
cout<<" . ."<<endl;
cout<<" . . ."<<endl;
cout<<" . ."<<endl;
cout<<" ."<<endl;
cout<<" T M";
for(i123=500;i123<=1000;i123+=100){
Beep(i123,1000);
}
system("cls");
char a[500][500]={"##############################",
"#o # ## # ### ####",
"# ###### # # # # # ### ####",
"# # ## # # #### # ### ##",
"# # ## ### # # ## ####",
"##### # # ##### ## ####",
"# # ##### # # # # # # {w上 s下 a左 d右}",
"# # # ## # #### ## # # ####",
"# # # ## ## # # ####",
"# # # ####### ## ###### # ##",
"# # ## # ## ###### ### #",
"# ###### # ##### # # #",
"# # # ##### ### # ",
"# ######## ##### # ### ### # #",
"# # ## ##### ### ###",
"##### # ## # ######## # #",
"# # ## ## ### # #",
"# # ### ###### ####### #",
"# # ### ## # #",
"##############################"};
int i,i1,x=1,y=1,n=12,m=29;
char ch;
for(i=0;i<=19;i++){
puts(a[i]);
}
while(x!=n||y!=m){
ch=getch();
if(ch==115||ch==25){
if(a[x+1][y]!=35){
a[x][y]=32;
x++;
a[x][y]=111;
}
}
if(ch==119||ch==24){
if(a[x-1][y]!=35){
a[x][y]=32;
x--;
a[x][y]=111;
}
}
if(ch==97||ch==27){
if(a[x][y-1]!=35){
a[x][y]=32;
y--;
a[x][y]=111;
}
}
if(ch==100||ch==26){
if(a[x][y+1]!=35){
a[x][y]=32;
y++;
a[x][y]=111;
}
}
system("cls");
for(i=0;i<=19;i++){
puts(a[i]);
}
}
for(i1=500;i1<=1000;i1=i1+100){
Beep(i1,1000);
}
cout<<endl<<"你赢了!!!祝贺你!!!"<<aa<<bb<<cc<<dd;
}
}
if(ab==2)
{
return 0;
}
else
{
cout<<"ID错误!!!!";
}
return 10;
}
c++小游戏——迷宫
最新推荐文章于 2023-09-25 21:06:54 发布