我用于计算折扣的 QBasic 代码如下:
CLS
INPUT "ENTER BILL AMOUNT";AMT
IF AMT <= 6000 THEN
DISCOUNT = 0
ELSEIF AMT > 6000 AND AMT <= 15000 THEN
DISCOUNT = 0.2 * AMT
ELSEIF AMT > 15000 AND AMT <= 50000 THEN
DISCOUNT = 0.3 * AMT
ELSEIF AMT > 50000 AND AMT <= 100000 THEN
DISCOUNT = 0.4 * AMT
ELSEIF AMT > 100000 AND AMT<= 200000 THEN
DISCOUNT = 0.5 * AMT
ELSEIF AMT > 200000 AND AMT <= 1000000 THEN
DISCOUNT = 0.6 * AMT
ELSE
DISCOUNT = 0.7 * AMT
END IF
NET = AMT - DISCOUNT
PRINT "THE BILL AMOUNT IS:"; NET
END
但是,在运行程序时,我在第 50 行(程序的第 5 行)出现错误,但在程序中找不到任何语法错误。