#include #include using namespace std; main() { initwindow(800,600); int x=100; int xt=150, yt=150; int a=10, b=10; char ch; rectangle(80-1,80-1,700+1,580); while(1) { setcolor(15); circle(xt,yt,10); rectangle(x,550,x+80,570); delay(100); if( yt==550) getch(); if(ch=='p') delay(1000); setcolor(0); circle(xt,yt,10); rectangle(x,550,x+80,570); if( kbhit() ) ch=getch(); if(ch=='d') x+=20; if(ch=='a') x-=20; if(ch=='q') return 1000; if(x<80) x=80; if(x>620) x=620; ch=' '; if(xt>=690)//rast a=-a; if(xt<=90)//chap a=-a; if(yt<=90)//saghf b=-b; if( (yt==540) && (x<=xt) && (xt<=x+80) ) b=-b; xt+=a; yt+=b; } getch(); }