Running Totals - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: Running Totals (/thread-1921.html) |
Running Totals - ElderQB - 09-05-2003 I am sending you a program which I have started to constuct. It is for recording by Bike Training on I cannot seem to make a Running Total of the Kilometers Rided Can you help me CLS OPEN "Record.rec" FOR APPEND AS #1 CLS PRINT "Cycling Record" PRINT "type END to quit" DO WHILE (day$ <> "END") INPUT "Date ", day$ IF (day$ <> "END") THEN INPUT "Kilometres ", Kms INPUT "Minutes", min Speed = Kms / (min / 60) WRITE #1, day$, Kms, min, Speed END IF LOOP CLOSE #1 INPUT "Press Enter to see the Total Record", dummy CLS OPEN "Record.rec" FOR INPUT AS #1 PRINT "Date Kms Mins Av.Speed " PRINT "---------------------------------" tmp$ = "\ \ ### ### ####.# " DO WHILE (NOT EOF(1)) INPUT #1, day$, Kms, min, Speed PRINT USING tmp$; day$; Kms; min; Speed LOOP CLOSE #1 Running Totals - Neo - 09-05-2003 Perhaps replacing: Code: WRITE #1, day$, Kms, min, Speed Code: PRINT #1, day$ + STR$(Kms) + STR$(min) + STR$(Speed) You'll thus get this: Code: CLS I've not used PRINT USING so much, so I can't predict if there's a mistake in the mask you set in tmp$. But according to me, this should work. Running Totals - Antoni Gual - 09-06-2003 You can keep the data entry part as it is, but modify the result printing part like this: Code: OPEN "Record.rec" FOR INPUT AS #1 |