用C语言写一个小软件或者小游戏,应该写什么?找一个思路,如果太难,可以改进的话最好!
#包含" stdafx.h "
# include & ltstdlib.h & gt
# include & ltconio.h & gt
void shuatu(int i,int j,char a[11][11],int x,int y);
char b[4]= "■";
char c =“”;
char d[4]= "☆";
int x,y;
int main(int argc,char* argv[])
{ char a[11][11]=
{
{'1','0','1','1','1','1','1','1','1','1','1'},
{'1','0','0','1','0','1','0','0','0','1','1'},
{'1','0','0','0','0','1','1','0','1','0','1'},
{'1','0','0','1','0','1','0','0','1','0','1'},
{'1','0','1','1','0','0','0','1','1','0','1'},
{'1','0','1','1','1','0','1','0','0','0','1'},
{'1','0','1','0','0','0','1','0','1','0','1'},
{'1','0','1','0','1','1','1','0','1','0','1'},
{'1','0','1','0','0','0','1','0','1','1','1'},
{'1','0','1','1','1','0','0','0','0','0','1'},
{'1','1','1','1','1','1','1','1','1','0','1'}
};
char e;
int i=0,j = 0;
x = 0;y = 1;
shuatu(i,j,a,x,y);
做
{
e = getch();
系统(“cls”);
开关(e)//用于方向控制。
{
格“a”:y-;
打破;
大小写:x++;
打破;
大小写“d”:y++;
打破;
格“w”:x-;
打破;
}
if(a[x][y]=='0 ')
shuatu(i,j,a,x,y);
其他
{
开关(e)
{
大小写“a”:y++;
打破;
大小写:x-;
打破;
格“d”:y-;
打破;
大小写“w”:x++;
打破;
}
shuatu(i,j,a,x,y);
printf("砰!\ n ");
}
if(x = = 10 & amp;& ampy==9)
{
printf("赢!\ n ");
打破;
}
} while(1);
返回0;
}
Void Shuatu (int i,int j,char a[11][11],int x,int y)//输出一个迷宫图形,是一面墙,为零,不在a[0][1]。
{
for(I = 0;我& lt11;i++)
{
for(j = 0;j & lt11;j++)
if(a[i][j]=='1 ')
printf("%s ",b);
其他
{
if(I = = x & amp;& ampj==y)
printf("%s ",d);
其他
{
putchar(c);
putchar(c);
}
}
printf(" \ n ");
}
}