Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
qbasic program exits without the "press any key to cont
#1
Hey. I have this problem with qbasic. Here is the code I am trying to get to work:

CLS
INPUT "Commission rate ===========> ", Rate
INPUT "Week 1 sales =============> ", Week1
INPUT "Week 2 sales =============> ", Week2
INPUT "Return sales =============> ", Returns
LET Commissions = Rate * (Week1 + Week2 - Returns)
PRINT
PRINT "Earned Commission ========>"; Commission
END

After typing the Return sales in and pressing enter the program exits without displaying Commission. I've search for a solution but can find the answer to forcing the program to stay open and display "press any key to continue". Thanks.
Reply
#2
Simple spelling error.
You assigned the variable commissions,
and the printed the variable commission, without the "s".

Try to keep variable names meaningful, or indicative, but as simple as possible.
*****
Reply
#3
After correcting the error pointed out by Moneo, just before your "END", enter this sentence:

INPUT "Enter any key to continue";A$
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#4
This would also work

Code:
PRINT "Press any key to continue..."
SLEEP

Sleep doesn't require pushing enter; it just waits for any keystroke...
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#5
Thanks alot. Now Im ready to move on. :rotfl:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)