Home » Archimedes archive » Acorn User » AU 1993-08.adf » !Bio_Bio » !Bio/Library/SumMean
!Bio/Library/SumMean
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1993-08.adf » !Bio_Bio |
Filename: | !Bio/Library/SumMean |
Read OK: | ✔ |
File size: | 0236 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Archimedes archive » Acorn User » AU 1993-08.adf » !Bio_Bio » !Bio/Library/SumMean
- Archimedes archive » Acorn User » AU 1993-09.adf » !Bio_Bio » !Bio/Library/SumMean
File contents
10REM >SumMean 20REM Calculate sum and mean 30: 40DEF FNsummean_name = "Total and Average" 50DEF FNsummean_args = "-in Text -results 3" 60DEF FNsummean_init 70=0 80: 90DEF FNsummean(in$,RETURN title$,RETURN s1$,RETURN s2$,RETURN s3$) 100LOCAL in%,items,s$,total,average 110in%=OPENIN(in$) 120WHILE NOT EOF#in% 130 PROChourglass(PTR#in%,EXT#in%) 140 s$=FNstrip_spaces(GET$#in%) 150 IF INSTR("0123456789+-.",LEFT$(s$,1))>0 AND s$<>"" THEN 160 items+=1 170 total+=VAL(s$) 180 ENDIF 190ENDWHILE 200CLOSE#in% 210IF items>0 average=total/items 220title$=FNleaf_name(in$) 230s1$="Items: "+STR$(items) 240s2$="Sum: "+STR$(total) 250s3$="Mean: "+STR$(average) 260=0
� >SumMean � Calculate sum and mean : ()� �summean_name = "Total and Average" 2+� �summean_args = "-in Text -results 3" <� �summean_init F=0 P: Z.� �summean(in$,� title$,� s1$,� s2$,� s3$) d � in%,items,s$,total,average nin%=�(in$) xȕ � �#in% � �hourglass(�#in%,�#in%) � s$=�strip_spaces(�#in%) �, � �"0123456789+-.",�s$,1))>0 � s$<>"" � � items+=1 � total+=�(s$) � � �� � �#in% �!� items>0 average=total/items �title$=�leaf_name(in$) �s1$="Items: "+�(items) �s2$="Sum: "+�(total) �s3$="Mean: "+�(average) =0 �
00000000 0d 00 0a 0e f4 20 3e 53 75 6d 4d 65 61 6e 0d 00 |..... >SumMean..| 00000010 14 1c f4 20 43 61 6c 63 75 6c 61 74 65 20 73 75 |... Calculate su| 00000020 6d 20 61 6e 64 20 6d 65 61 6e 0d 00 1e 05 3a 0d |m and mean....:.| 00000030 00 28 29 dd 20 a4 73 75 6d 6d 65 61 6e 5f 6e 61 |.(). .summean_na| 00000040 6d 65 20 3d 20 22 54 6f 74 61 6c 20 61 6e 64 20 |me = "Total and | 00000050 41 76 65 72 61 67 65 22 0d 00 32 2b dd 20 a4 73 |Average"..2+. .s| 00000060 75 6d 6d 65 61 6e 5f 61 72 67 73 20 3d 20 22 2d |ummean_args = "-| 00000070 69 6e 20 54 65 78 74 20 2d 72 65 73 75 6c 74 73 |in Text -results| 00000080 20 33 22 0d 00 3c 13 dd 20 a4 73 75 6d 6d 65 61 | 3"..<.. .summea| 00000090 6e 5f 69 6e 69 74 0d 00 46 06 3d 30 0d 00 50 05 |n_init..F.=0..P.| 000000a0 3a 0d 00 5a 2e dd 20 a4 73 75 6d 6d 65 61 6e 28 |:..Z.. .summean(| 000000b0 69 6e 24 2c f8 20 74 69 74 6c 65 24 2c f8 20 73 |in$,. title$,. s| 000000c0 31 24 2c f8 20 73 32 24 2c f8 20 73 33 24 29 0d |1$,. s2$,. s3$).| 000000d0 00 64 20 ea 20 69 6e 25 2c 69 74 65 6d 73 2c 73 |.d . in%,items,s| 000000e0 24 2c 74 6f 74 61 6c 2c 61 76 65 72 61 67 65 0d |$,total,average.| 000000f0 00 6e 0e 69 6e 25 3d 8e 28 69 6e 24 29 0d 00 78 |.n.in%=.(in$)..x| 00000100 0e c8 95 20 ac 20 c5 23 69 6e 25 0d 00 82 1c 20 |... . .#in%.... | 00000110 f2 68 6f 75 72 67 6c 61 73 73 28 8f 23 69 6e 25 |.hourglass(.#in%| 00000120 2c a2 23 69 6e 25 29 0d 00 8c 1c 20 73 24 3d a4 |,.#in%).... s$=.| 00000130 73 74 72 69 70 5f 73 70 61 63 65 73 28 be 23 69 |strip_spaces(.#i| 00000140 6e 25 29 0d 00 96 2c 20 e7 20 a7 22 30 31 32 33 |n%)..., . ."0123| 00000150 34 35 36 37 38 39 2b 2d 2e 22 2c c0 73 24 2c 31 |456789+-.",.s$,1| 00000160 29 29 3e 30 20 80 20 73 24 3c 3e 22 22 20 8c 0d |))>0 . s$<>"" ..| 00000170 00 a0 0e 20 20 69 74 65 6d 73 2b 3d 31 0d 00 aa |... items+=1...| 00000180 12 20 20 74 6f 74 61 6c 2b 3d bb 28 73 24 29 0d |. total+=.(s$).| 00000190 00 b4 06 20 cd 0d 00 be 05 ce 0d 00 c8 09 d9 23 |... ...........#| 000001a0 69 6e 25 0d 00 d2 21 e7 20 69 74 65 6d 73 3e 30 |in%...!. items>0| 000001b0 20 61 76 65 72 61 67 65 3d 74 6f 74 61 6c 2f 69 | average=total/i| 000001c0 74 65 6d 73 0d 00 dc 1a 74 69 74 6c 65 24 3d a4 |tems....title$=.| 000001d0 6c 65 61 66 5f 6e 61 6d 65 28 69 6e 24 29 0d 00 |leaf_name(in$)..| 000001e0 e6 1a 73 31 24 3d 22 49 74 65 6d 73 3a 20 22 2b |..s1$="Items: "+| 000001f0 c3 28 69 74 65 6d 73 29 0d 00 f0 1a 73 32 24 3d |.(items)....s2$=| 00000200 22 53 75 6d 3a 20 20 20 22 2b c3 28 74 6f 74 61 |"Sum: "+.(tota| 00000210 6c 29 0d 00 fa 1c 73 33 24 3d 22 4d 65 61 6e 3a |l)....s3$="Mean:| 00000220 20 20 22 2b c3 28 61 76 65 72 61 67 65 29 0d 01 | "+.(average)..| 00000230 04 06 3d 30 0d ff |..=0..| 00000236