Qbasicnews.com

Full Version: Please Help :)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am an old user of QBasic and have not used it in about 5 years and have recently started some basic programming again. I was wondering if some one could help me figure out a problem that I am having with the following code.

CLS
INPUT "ENTER VALUE"; VALUE
PRINT
PRINT "ANSWER"; ANSWER
ANSWER = VALUE * 6

When I run this very simple code the answer that I recieve is always 0. Can anyone tell me what I am doing wrong? I know this will be simple for all of you, but remeber it has been about 5 years for me. :rotfl: Big Grin
it's because you're printing your answer before you make anything of it. put the answer = value * 6 in front of the print statement, like this:

CLS
INPUT "ENTER VALUE"; VALUE

ANSWER = VALUE * 6

PRINT
PRINT "ANSWER"; ANSWER
Just think about a program like a recipe. QB just follows the instructions top down, so you have to tell it to do things in the correct order.
Quote:Just think about a program like a recipe. QB just follows the instructions top down, so you have to tell it to do things in the correct order.

if you don´t use gotos to do alot of jumping around in it Tongue
[Image: shocked.jpg]
:o man, you must have forgot everything about programming hehe

Remember that a programming language (almost any) works from the top and down
That means that:

z = 7
print z ' prints 7 to screen
y = x * 3
x = 5
print y ' prints 21 (and not 15) to screen
print x ' prints 5 to screen

Oh well, good luck at getting into it again :wink:
except Javascript incrementors.. :-?
:o :roll:
Yes I have forgot almost everything. I have been spending along time doing 3d CAD software work and learing highend programs like Pro/E and SDRC I-Deas. But now that I have time to learn programming again I plan to. I hope that you guys can provide me with all the help that I need Tongue

Thanks for the help so far!!!