#define _CRT_SECURE_NO_WARNINGS 1
#include<graphics.h>
#include<conio.h>
int main()
{
int high = 480, wide = 640;
float ball_x = wide / 2;
float ball_y = high / 2;
float radius = 20;
float ball_vx = 3, ball_vy = 3;
initgraph(wide, high);
BeginBatchDraw();
while(1)
{
setcolor(RED);
setfillcolor(RGB(255,0,0));
fillcircle(ball_x, ball_y, radius);
FlushBatchDraw();
Sleep(1);
setcolor(BLACK);
setfillcolor(BLACK);
fillcircle(ball_x, ball_y, radius);
ball_x += ball_vx;
ball_y += ball_vy;
if ((ball_x <= radius) || (ball_x >= wide - radius))
ball_vx *= -1;
if ((ball_y <= radius) || (ball_y >= high - radius))
ball_vy *= -1;
}
EndBatchDraw();
}