本帖最后由 子浩 于 2015-6-22 18:50 编辑
[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{ //012345678910
char s,a[20][20]={" ### ",
" #*# ",
" #@# ",
"#### ######",
"#* @H @ *#",
"####@######",
" # # ",
" #*#",
" ###"};
int i,n=0,x=4,y=4,m,z;
for(i=0;i<11;i++)
puts(a);
while(n!=4)//分数
{
s=getche();
if(s=='w')
{
if(a[x-1][y]==' ')
if(a[x-2][y]==' '||a[x-2][y]=='#')
{
a[x][y]==' ';
x--;
a[x][y]=='H';
}
if(a[x-1][y]=='@')
if(a[x-2][y]==' '||a[x-2][y]=='*')
{
if(a[x-2][y]=='*')
n++;
m=x-2;
z=y;
a[m][z]=='@';
x--;
a[x][y]=='H';
}
}
system("cls");
for(i=0;i<11;i++)
puts(a);
}
system("pause");
return 0;
}
[/mw_shl_code] |