home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug024.arc
/
GRAFALL.ASC
< prev
next >
Wrap
Text File
|
1979-12-31
|
3KB
|
67 lines
GRAFALL.MWB
This file is included because of a fault in the original listing
0010░ DI═ A(8),A0(200⌐ [181]
00110 A(0) = INT(RND*170)+20 : A(2) = INT (RND*2) : A(3) = INT (RND*3) █▒▒▓▌
00120 A0(0) = RND*180 █▒░╡▌
00130 FOR I = 1 TO A(0)+1 : A0(I) = A0(I-1)+(RND*9)-5 : NEXT I █▒╣╖▌
04000 REM The following routine will graph real numbers █▒╣╢▌
04010 REM from -99999 to +99999. Put data in variables : █▒╣╖▌
04020 REM a0( ) Array containing the data █▒╣╕▌
04030 REM a(0) No of data to be graphed -1 █▒╣╣▌
04040 REM a(2) 1 = HIRES 0 = LORES █▓░░▌
04050 REM a(3) 0 = Bar 1 = Dot 2 = line graph █▓░▒▌
04060 REM █▓░▓▌
04070 A1 = 99999 : A7 = -99999 █▓░╕▌
04080 FOR I = 0 TO A(0) █▓░╢▌
04090 IF A0(I) <A1 : A1 = A0(I) : REM find minimum █░╢╖▌
04100 IF A0(I) >A7 : A7 = A0(I) : REM find maximum █░╖│▌
04110 NEXT I █░╖╕▌
04120 A2 = A7 - A1 : REM Range of values █▓░░▌
04130 IF A2 = 0 : CURS 1,8 : PRINT"Data all equal " : PLAY 22; 0, 8 :
GOTO 130 █░╣╣▌
04140 IF A(2) = 1 THEN 4160 █▒│▓▌
04150 CLS : LORES : A3 = 45 : A4 = 110 : GOTO4170 █▒▓┤▌
04160 CLS : HIRES : A3 = 250 : A4 = 450 █▒░╡▌
04170 A2 = A2/A3 : REM step factor vertical █▓░┤▌
04180 A(4) = INT(A4/FLT(A(0))) : REM step factor horizontal █▓▓╖▌
04190 IF A(4)<1 : CURS 1,8 : PRINT"Too many values" : PLAY 22; 0, 8 :
GOTO 130 █░╖▓▌
04200 A(5) = INT(A4/8)+2 : REM Y axis █▒▓▒▌
04210 PLOT A(5),INT(A3) TO A(5),0 : REM TO A(5)+INT(A4)+1,0 :
REM print axes █▒╢╣▌
04220 IF A1<-9999.9 OR A7>9999.9 THEN 4240 █░▓┤▌
04230 CURS 1,16 : PRINT [F7.1 A1]; : CURS 1,1 : PRINT [F7.1 A7] :
GOTO 4250 █▓│▓▌
04235 REM label axes █▓░╢▌
04240 CURS 1,16 : PRINT [F7.0 A1]; : CURS 1,1 : PRINT [F7.0 A7] :
GOTO 4250 █▓│▒▌
04250 A(6) = INT((A0(0)-A1)/A2) : REM 1st value for plot █▓░▓▌
04260 ON A(3)+1 GOTO 4270, 4330, 4390 █▒│░▌
04265 REM Bar graph █▓░╣▌
04270 FOR I = 0 TO A(0) █▓░╖▌
04280 A(8) = I*A(4)+A(5)+1 : REM horizontal coordinate █▒╡░▌
04290 A(7) = INT((A0(I)-A1)/A2) : REM vertical coordinate █▓│▓▌
04300 PLOT A(8),0 TO A(8),A(7) █▒┤▓▌
04310 NEXT I █░╕░▌
04320 GOTO 4450 █▓░╖▌
04325 REM Dot graph █▓░╢▌
04330 FOR I = 0 TO A(0) █▓░┤▌
04340 A(8) = I*A(4)+A(5)+1 : REM horizontal coordinate █▒┤╖▌
04350 A(7) = INT((A0(I)-A1)/A2) : REM vertical coordinate █▓▓╣▌
04360 SET A(8),A(7) █▒▓░▌
04370 NEXT I █░╕╢▌
04380 GOTO 4450 █▓▒│▌
04385 REM Line graph █▓▒▓▌
04390 FOR I = 1 TO A(0) █▓▒▒▌
04400 A(8) = I*A(4)+A(5) : REM horizontal coordinate █░╡▓▌
04410 A(7) = INT((A0(I)-A1)/A2) : REM vertical coordinate █▓▓╢▌è04420 PLOT A(8),A(7) TO A(8)-A(4),A(6) █░▓╕▌
04430 A(6) = A(7) █▒╡│▌
04440 NEXT I █░╕┤▌
04450 IF A1<0 AND A7>0 : PLOTI A(5)+1,INT(-A1/A2) TO INT(A4)+A(5)+1,
INT(-A1/A2): CURS 1,INT((16*A7)/(A7-A1))+1 : PRINT" 00.0" █▓┤▓▌
04455 REM plot and label x axis if it is on screen █▓▒░▌
04460 IF KEY <> " " THEN 4460 █░░▒▌
10000 GOTO 110 █▒╕╕▌