第一次用TURBOC编,只学过一点C++
# include <graphics.h >
main ( )
{
int gdriver = DETECT, gmode ;
initgraph ( &gdriver , &gmode , "");
setbkcolor ( LIGHTBLUE ) ;
int x0,y0,r;
x0=50,y0=20,r=20;
while(x0<w-200)
{
putmoon(x0,y0,r);
delay(20000);
erasemoon(x0,y0,r);
x0=x0+2;
}
putmoon(x0+10,y0,r);
void putstar()
{
int i,w,h,dotx,doty,t;
w=getmaxx();
h=getmaxy();
for(i=0;i<100;i++)
{
dotx=random(w-1);
doty=random(h-1);
t=random(3);
setfillstyle(1,WHITE);
fillellipse(dotx,doty,t,t);
};
}
closegraph ( ) ;
}
void putmoom(x0,y0,r)
{
setfillstyle(1,WHITE);
setcolor(WHITE);
fillellipse(x0,y0,r,r);
setfillstyle(1,LIGHTBLUE);
setcolor(LIGHTBLUE);
fillellipse(x0+15,y0+3,r-2,r-2);
}
void erasemoon (x0,y0,r)
{
setfillstyle(1,LIGHTBLUE);
setcolor(LIGHTBLUE);
fillellipse(x0,y0,r,r);
}
![]()