迷宫游戏纸
# include & ltwindows.h & gt
# include & ltconio.h & gt
使用命名空间std
int main()
{
int I 123;
cout & lt& lt" ."& lt& ltendl
cout & lt& lt"?。."& lt& ltendl
cout & lt& lt" .。."& lt& ltendl
cout & lt& lt"?。."& lt& ltendl
cout & lt& lt" ."& lt& ltendl
cout & lt& lt"?t M”;
for(I 123 = 500;I 123 & lt;=1000;i123+=100){
哔声(i123,1000);
}
系统(“cls”);
char a[50][50]= { " # # # # # # # # # # # # # # # # # # # # # ",
“#o?# ## # ### ####",
"# ###### # # # # # ### ####",
"# # ## # # #### # ### ##",
"# # ##?### #?#?## ####",
"##### # ?# ##### ## ####",
"# # ##### # # # # # #",
"# # # ## # #### ## # # ####",
"# # # ## ?## ?# # ####",
"# # # ####### ## ###### # ##",
"# # ## # ## ###### ### #",
"# ###### # #####?# # #",
"# # # ?##### ### #? ",
"# ######## ##### # ### ### # #",
"# ?# ## ##### ### ###",
"##### # ## # ?######## # #",
"# ?# ## ## ### # #",
"# # ### ###### ####### #",
"# # ### ## ?# ?#",
"##############################"
};
int i,i1,x=1,y=1,n=12,m = 29
char ch
for(I = 0;我& lt=19;i++){
puts(a[I]);
}
而(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;
}
}
系统(“cls”);
for(I = 0;我& lt=19;i++){
puts(a[I]);
}
}
for(I 1 = 500;I 1 & lt;=1000;i1=i1+100){
哔声(i1,1000);
}
cout & lt& ltendl & lt& lt“你赢了!!!恭喜你!!!";
系统(“暂停”);
}