home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
ARRSUM_I.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
5KB
|
76 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME ARRSUM_I.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NB01.INC"
COLOR 7, 0
CLS
? "┌──────────────────────────────────────────────────────────────────────────
? "│ fArrSumI?? ( ANYnumber, Els2Count%, StopAtSum??, ElsCounted%, StepSize% )
? "├──────────────────────────────────────────────────────────────────────────
? "│ fArrSumI can count the elements of an array or a type. There are some natural
? "│ restrictions to the total and number of elements counted, etc. but they are
? "│ sufficiently high to allow for it's use under most circumstances. If you
? "│ assign a value of ZERO to StopAtSum?? fArrSumI will total all the elements,
? "│ but if it's value is > ZERO then fArrSumI will stop counting at the element
? "│ that offers a total =< StopAtSum?? and will return the number of elements
? "│ counted in ElsCounted%. StepSize% controls the number of bytes `skipped`
? "│ between the counted elements. ie: a one dimension integer array requires a
? "│ step size of +/- 2 (2 bytes) where a TYPE could be almost any number.
? "└───────────────────────────────────────────────────────────────────────────────"
'┌────────────────────────
RESTORE WEEKDAYS '│
DIM WeekDay(0:6) AS STRING '│ DOS uses ZERO for Sunday
FOR X% = 1 TO 6 '│ so we do the same just
READ WeekDay$( X% ) '│ to keep in step!
NEXT '│
PRINT "TIME CARDS W06 W07 TOTAL" '│
PRINT "──────────────────────────────" '│
'│
RESTORE MINUTESWORKED '│
DIM T(0:6,1:53) AS INTEGER '│ Note how T%() has been
FOR X% = 1 TO 6 '│ DIMed with the days 1st
READ T%(X%,6) '│ This causes the data to
READ T%(X%,7) '│ be stored SMTWTFSSMTWTFS
PRINT WeekDay$( X% ); '│ while the 2ed element
PRINT USING " ### ###";T%(X%,6),T%(X%,7) '│ points to Sunday of the
NEXT '│ week number.
'│
W6?? = fArrSumI??( T%(0,6), 7, 0, 0, 2 ) '│ get the total for each
W7?? = fArrSumI??( T%(0,7), 7, 0, 0, 2 ) '│ week
PRINT "──────────────────────────────" '│
PRINT USING "TOTALS: #,### #,###";W6??,W7?? '│
FOR D% = 1 TO 6 '│ get the totals for each
Dt?? = fArrSumI??( T%(D%,6), 2, 0, 0, 14 ) '│ week day for both weeks
LOCATE (D%+16), 26 '│ 7days x 2byte = 14
PRINT USING "#,###"; Dt?? '│
NEXT '│
Tt?? = fArrSumI??( T%(0,6), 14, 0, 0, 2 ) '│ total of both weeks
LOCATE 24, 26 : PRINT USING "#,###"; Tt?? '│
'│
'──────────────────────────────────────────────────┼─────────────────────────
'──────────────────────────────────────────────────┼─────────────────────────
WEEKDAYS: '│ DATA STATEMENTS
DATA " MONDAY:", " TUESDAY:", "WEDNESDAY:" '│
DATA " THURSDAY:", " FRIDAY:", " SATURDAY:" '│
MINUTESWORKED: '│
DATA 471, 481, 479, 482, 477, 122 '│
DATA 471, 481, 479, 482, 477, 0 '│