#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
int main()
{
char a[20][42]={"########################################",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"########################################"
};
int i;
int top=1;
int lowest=20;
int you=20;
int zuo=1;
int x=5;
int y=10;
int velocicty_x=1;
int velocicty_y=1;
while(1)
{
system("cls");
a[x][y]='0';
for(i=0;i<20;i++)
puts(a[i]);
a[x][y]=' ';
if(a[x]==a[1] || a[x]==a[18])
{
velocicty_x=-velocicty_x;
}
x=x+velocicty_x;
if(a[x][y+1]=='#' || a[x][y-1]=='#')
{
velocicty_y=-velocicty_y;
}
y=y+velocicty_y;
/*for(i=1;i<x;i++)
{
printf("\n");
}
for(i=1;i<y;i++)
{
printf(" ");
}*/
//printf("\n");
Sleep(100);
/*if(x==top || x==lowest)
{
velocicty_x=-velocicty_x;
}
if(y==zuo || y==you)
{
velocicty_y=-velocicty_y;
}*/
}
return 0;
}
02-26
2885
06-21
738
10-07
213