out() { int key; key=bioskey(0); if(key==ESC) exit(0); }
void main(void)
{ int minx=40; int miny=40; int maxx=400; int maxy=400; int x,y; int cx,cy; int addx=1,addy=-1; x=(minx+maxx)/2; y=(miny+maxy)/2; int driver,mode; driver=DETECT; initgraph(&driver,&mode,""); rectangle(40,40,400,400);
while(1) { cx=x,cy=y; x=x+addx,y=addy+y; if(x<=minx+R+1||x>=maxx-R-1) addx=-addx; if(y<=miny+R+1||y>=maxy-R-1) addy=-addy; setcolor(BLACK); circle(cx,cy,R); delay(600); setcolor(WHITE); circle(x,y,R); if(bioskey(1)) out(); } } 我就是不懂错在哪里,希望各位能帮下我,我是初学的菜鸟