start tok64 d64-68C3kq 100 REM ***************** 110 REM ** ** 120 REM ** pie chart ** 130 REM ** ** 140 REM ***************** 150 REM 160 PRINT"{clear}{down}{right}enter values. end with -1. 170 DIMp(200):c=1 180 PRINT"#"c,:INPUTp(c):IFp(c)<.THENc=c-1:GOTO230 200 su=su+p(c):c=c+1:GOTO180 230 REM **** graphic routines **** 240 REM **************** 250 in=51200:of=51203 260 gc=51206:sc=51209 270 pc=51212:pl=51215 280 up=51218:sl=51221 290 cl=51224:gl=51227 300 gs=51230:hc=51233 320 REM 330 REM **** ellipse **** 340 REM ******* 360 SYSin:SYSgc:SYSsc,16*5+13:REM initialize graphics 370 a=100:b=60:v1=160:v2=80:REM parameters 380 an=.:GOSUB930:x1=x:y1=y:REM set x1 and y1 390 sp=7*{pi}/180:REM step 400 be=.:en=2*{pi}:REM start and end angle 410 GOSUB800:REM draw ellipse 420 be=.:en=1.03*{pi}:REM approx 180 degrees 430 v2=100:REM set deeper 440 GOSUB800:REM draw ellipse 500 REM 510 REM **** pie pieces **** 520 REM ********** 580 an=. 590 FORs=1TOc 600 pr=p(s)/su:REM calculate percent 610 as=2*{pi}*pr:REM angle of section 620 an=an+as:REM real angle 630 v2=80:GOSUB930:REM calculate line 640 SYSsl,v1,v2,x,y:REM dividing line 650 IFan>{pi}THEN690:REM only on visible side 660 x1=x:y1=y:REM save 670 v2=100:GOSUB930:REM calculate lower coord. 680 SYSsl,x1,y1,x,y:REM vertical to lower arc 690 NEXT 799 WAIT198,255:SYSof:END 800 REM 810 REM **** ellipse arcs **** 820 REM ************ 830 FORan=beTOen+spSTEPsp:REM detemine angle 840 GOSUB930:REM determine coordinates 850 SYSsl,x1,y1,x,y:REM line 860 x1=x:y1=y 870 NEXT:RETURN 900 REM 910 REM **** calculate point **** 920 REM *************** 930 x=a*COS(an)+v1 940 y=b*SIN(an)+v2:RETURN stop tok64 (bastext 1.0)