-
Notifications
You must be signed in to change notification settings - Fork 0
/
TIMETRAK.19920610.PAS
47 lines (37 loc) · 1.29 KB
/
TIMETRAK.19920610.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Program TimeTrack ;
uses
crt ;
var
TotalSeconds,
TotalMinutes,
i, k, NumTracks : integer ;
TrackTime : real ;
begin
clrscr ;
writeln (' This is a program to track the total amount of time for a') ;
writeln ('collection of songs. First, you''ll have to enter the number') ;
writeln ('of tracks. Second, enter the time for each song in the format') ;
writeln ('MM.SS where MM = minutes & SS = seconds. To exit, enter a zero') ;
writeln ('for the number of tracks.') ;
writeln ;
repeat
write ('Number of tracks: ') ; readln (NumTracks) ;
TotalSeconds := 0 ;
TotalMinutes := 0 ;
if NumTracks > 0 then
begin
for I := 1 to NumTracks do
begin
write ('Time for track ', I:2, ': ') ;
readln (TrackTime) ;
TotalMinutes := TotalMinutes + trunc (TrackTime) ;
TotalSeconds := TotalSeconds + round (100 * frac (TrackTime)) ;
end ;
TotalMinutes := TotalMinutes + TotalSeconds div 60 ;
TotalSeconds := TotalSeconds mod 60 ;
writeln ;
writeln ('The total time is ', TotalMinutes:0, ':', TotalSeconds:0) ;
writeln ;
end ;
until Numtracks < 1
end.