Syntax Error

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

JasonQuinn1992
Coder
Posts: 42
Joined: Mon Sep 03, 2012 4:32 pm

Post by JasonQuinn1992 »

Even when i retried the template you provided me with I still got an error on

ReadData:
READ Manufact$, Yr, Make, Model, Desc, Price


here is my code now:

' Program that lists inventory for your collection of model cars
'
'
'
' Variables Used

' T1$, H1$, H2$, D1$ Print images
' TL$ Print images
' Manufact$ Manufacturer #
' Yr Year Of Car
' Make$ Make of Car
' Model$ Model Of Car
' Desc$ Description of car
' Price Price Of Car
' TotPrice Tot Price Of Cars

' Program Mainline

CLS
GOSUB InitializeVariables
GOSUB PrintHeadings
GOSUB ProcessDetail
GOSUB PrintTotals
END

' Initalize Variables

InitializeVariables:
LET T1$ = ""
LET H1$ = ""
LET H2$ = " Manufacturer # Yr Make Description Price"
LET D1$ = "\ \ ## \ \ \ \ $ ###.##"
LET TL$ = " TOTAL $ ###.##"
RETURN

'
' Initialize Imagees

InitializeImages:

' T1$ Title Line
' H1$, H2$ Column Headings
' D1$ Deatail (manufacturer #, Yr, Make, description, price)
' TL$ Totals

' LPRINT HEADINGS

PrintHeadings:
PRINT T1$; 'Print title line
PRINT
PRINT H1$ 'Print column headings, line 1
PRINT H2$ 'Print column headings, line 2
PRINT
RETURN

D1$ = "Manufact & Yr: ## Make: & & Desc: & Price $&"

'Process Detail

ProcessDetail:
GOSUB ReadData
DO UNTIL Manufact$ = "END"
GOSUB CalculateTotal
GOSUB PrintDetail
GOSUB ReadData
LOOP

END

GOSUB ReadData

ReadData:
READ Manufact$, Yr, Make, Model, Desc, Price$
RETURN
DATA BMR-R79, 49, FIAT, 500B, GILLETE RAZOR, 7.99
DATA HOTWELS-34, 57, CHEVY, NOMAD, 4/DR STATION WAGON, 12.95
DATA MATCHBX-878, 73, FORD, BRONC, 3/DR 4X4 RED SPARE WHL, 25.99
DATA MATCHBX-72, 69, BUIK, CENTY, YELLOW TAXI, 1.49
DATA BRM-R88, 34, BUGANT, TY575, RACER, BLACK 35.00
DATA MATCHBX-25, 80, LINCO, MRKIV, WHITE, LIMOUSINE, 14.99
DATA LESNEY-Y42, 82, CHEVY, MALBU, 4/DR GREEN PASSENGER, 1.99
DATA HASBRO-119, 75, AMC, GRMLN, 2/DR SENAN, YELLOW, 1.69
DATA TABY-6332, 71, TOYOT, CELIC, 2/DR SEDAN, BLUE, 2.99
DATA BMR-SY238, 36, ROLRY, SYLVC, 4/DR SEDAN, SILVER-GRAY, 60.00
DATA "END",0,0,0,0,0,0
RETURN

PrintDetail:
PRINT USING D1$; Manufact$; Yr; Make; Model; Desc; Price
RETURN



' Calculate Total

CalculateTotal:
LET TotPrice = TotPrice + Price

' Print Totals

PrintTotals:
PRINT
PRINT USING TL$; TotPrice; Price 'Print total line
RETURN
Post Reply