|
板凳
楼主 |
发表于 2018-1-30 12:55:34
|
只看该作者
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
char a[50][50]={" ###",
" #*#",
"#####o######",
"#* os o *#",
"#######o####",
" # #",
" #*#",
" ###",
}
int o,i,i1,x1,x2,x3,x4,x5,x6,x7;
x1=1;x2=5;x3=3;x4=1;x5=10;x6=6;x7=7;i=1;i1=1;
char m;
for(i=0;i<=7;i++)
pust(a[i]);
while(a[x1][x5]!='o'||a[x3][x4]!='o'||a[x3][x5]!='o'||a[x6][x7]!='o')
{
m=getch();
if(m=='s')
{
if(a[i+1][i1]!='#')
{
a[i][i1]=' ';
i++;
a[i][i1]='s';
if(a[i][i1]=='o'||a[i+1][i1]!='#')
{
a[i+1][i1]='o';
}
if(a[i][i1]=='o'||a[i+1][i1]=='#')
{
a[i-1][i1]='s';
a[i][i1]='o';
}
pust(a[i]);
}
}
}
system("pause");
return 0;
}
|
|