用QBASIC制作五彩缤纷的烟花
程序清单如下:
SCREEN 13
DIM col(10)
col(0)=9:col(1)=10:col(2)=11
col(3)=12:col(4)=13:col(5)=14
DIM a(150)
b=150
FOR i=1 TO 150
b=b*0.95
a(i)=150-b
NEXT i
rept:
x=INT(319*RND(1))
y=INT(100*RND(1))
z=INT(6*RND(1))
FOR i=1 TO 75
IF i>68 THEN GOTO sk
CIRCLE (x,y),a(i),col(z),0,0.6
CIRCLE (x,y),a(i),col(z),1.046,1.646
CIRCLE (x,y),a(i),col(z),2.094,2.694
CIRCLE (x,y),a(i),col(z),3.139,3.739
CIRCLE (x,y),a(i),col(z),4.187,4.787
CIRCLE (x,y),a(i),col(z),5.232,5.832
sk:
fOR k=1 TO 3000 STEP 10:NEXT k
IF i<10 THEN GOTO skip
CIRCLE (x,y),a(i-10),0
skip:
NEXT i
FOR k=1 TO 10000 STEP 1:NEXT k
GOTO rept
END