这是一个移动动画,哪里有错误?忘高手解答
#include<stdio.h> #include<conio.h>
int main()
{
struct point
{
int x,y;
int xv,yv;
}man;
long p;
man.x=man.y=20;
man.xv=man.yv=1;
clrscr();
p=100000000;
while(p--)
{
if(p%50000) continue;
gotoxy(man.x,man.y);
printf(" ");
man.x+=man.xv;
if(man.x<10) { man.x=10; man.xv*=-1; }
else if(man.x>70) { man.x=70; man.xv*=-1; }
man.y+=man.yv;
if(man.y<10) { man.y=10; man.yv*=-1; }
else if(man.y>70) { man.y=70; man.yv*=-1; }
gotoxy(man.x, man.y);
printf("%c\b",2);
}
getch();
return 0;
}