Qbasic Program wont run

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
RichK88
Newbie
Posts: 2
Joined: Mon Sep 17, 2018 11:39 am

Qbasic Program wont run

Post by RichK88 »

I am unable to get this program to work. everything was going good until i added the PRINT stuff so i think that is where mt problem lies. i did it from what i can tell exactly how the book shows it and it still wont run. If anybody can point me in the right direction!

Rem Richard Kopycinski
'***************************** Piecework Workers ****************************
'
CLS
GOSUB InitalizeImage
GOSUB PrintHeading
GOSUB ProcessDetail
GOSUB PrintTotal
END
'***************************** Initalize Image ******************************
InitalizeImage:
T1$ = " PIECEWORK WEEKLY REPORT "
H1$ = " NAME PIECES PAY "
D1$ = " / / ### ###.## "
TL$ = "TOTALS: #,### #,###.## "
RETURN
'****************************** Print Heading *******************************
PrintHeading:
PRINT
PRINT T1$ 'Print Title Line
PRINT
PRINT H1$ 'Heading Line
PRINT
PRINT
RETURN
'****************************** Process Detail ******************************
'
CLS
ProcessDetail:
GOSUB ReadData
DO UNTIL Name$ = "Last Record"
GOSUB CalculateAnswer
GOSUB PrintDetail
GOSUB ReadData
LOOP
RETURN
'
'******************************* Read Data **********************************
ReadData:
READ Name$, Pieces
DATA JOHNNY BEGOOD, 265
DATA SALLY GREAT, 650
DATA SAM KLUTZ, 177
DATA PETE PRECISE, 400
DATA FANNIE FANTASTIC, 399
DATA MORRIE MELLOW, 200
DATA "Last Record", 0
RETURN
'
'****************************** Calculate Answer ****************************
CalculateAnswer:
IF Pieces >= 1 AND Pieces <= 199 THEN
Rate = 0.50
ELSEIF Pieces >= 200 AND Pieces <=399 THEN
Rate = 0.55
ELSEIF Pieces >= 400 AND Pieces <=599 THEN
Rate = 0.60
ELSEIF Pieces >= 600 THEN
Rate = 0.65
ELSE RATE = 0
END IF
Pay = (PIECES * Rate)
TotPieces = (TotPieces + PIECES)
TotPay = (TotPay + Pay)
RETURN
'******************************* Print Detail *******************************
Print Detail:
PRINT USING D1$; Name$, Pieces, Pay
RETURN
'******************************* Print Total ********************************
PrintTotal:
PRINT
PRINT USING TL$; TotPieces, TotPay
PRINT
RETURN
'****************************** END OF PROGRAM *******************************
MikeHawk
Veteran
Posts: 61
Joined: Sun Jul 08, 2018 11:23 am

Re: Qbasic Program wont run

Post by MikeHawk »

Try using backslashes instead of forward slashes in D1$, and remove the excess spacing for the "Print Detail" label.
Post Reply