#include <graphics.h>
#include <conio.h>
void main()
{
initgraph(640, 480);
int y = 80 ;
int xx = 20;
int yy = 20;
for(int x=100;; x+=xx,y+=yy)
{
// 绘制黄线、绿色填充的圆
setlinecolor(YELLOW);
setfillcolor(GREEN);
fillcircle(x, y, 20);
// 延时
Sleep(500);
// 绘制黑线、黑色填充的圆
setlinecolor(BLACK);
setfillcolor(BLACK);
fillcircle(x, y, 20);
if(x>=620 || x<=20) //碰到边界反方向
xx = -xx;
if(y >=460 || y<=20)
yy = -yy;
}
closegraph();
}
#include <conio.h>
void main()
{
initgraph(640, 480);
int y = 80 ;
int xx = 20;
int yy = 20;
for(int x=100;; x+=xx,y+=yy)
{
// 绘制黄线、绿色填充的圆
setlinecolor(YELLOW);
setfillcolor(GREEN);
fillcircle(x, y, 20);
// 延时
Sleep(500);
// 绘制黑线、黑色填充的圆
setlinecolor(BLACK);
setfillcolor(BLACK);
fillcircle(x, y, 20);
if(x>=620 || x<=20) //碰到边界反方向
xx = -xx;
if(y >=460 || y<=20)
yy = -yy;
}
closegraph();
}