Qbasicnews.com
Weight in Space input problem - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: Weight in Space input problem (/thread-5193.html)

Pages: 1 2


Weight in Space input problem - rhoward88 - 12-01-2004

heres my code so far, my input isnt allowing letters only numbers

Code:
cls
input "Input Friends Name";nameA
input "Input Friends Weight";weight1

'planets gravity
mercury = .27
venus = .85
earth = 1
moon = .16
mars =.18
jupiter = 2.64
saturn = 1.17
uranus = .92
neptune = 1.12
when i input a friends name as a test it wont take it however it will allow the numbers.


Weight in Space input problem - Oz - 12-01-2004

[syntax="qbasic"]cls
input "Input Friends Name";nameA$[/syntax]

there must be the '$' after the varible to say it is a string

Oz~


Weight in Space input problem - red_Marvin - 12-01-2004

Or, at the start:
[syntax="qbasic"]dim nameA as string[/syntax]


Weight in Space input problem - whitetiger0990 - 12-02-2004

[syntax="QBASIC"]INPUT "Your weight? ", weight
PRINT "Your weight in space is"; weight * 0[/syntax]

Shhhhhhhhhhhhhhhhhh
Sorry had to :roll:


Weight in Space input problem - TheBigBasicQ - 12-02-2004

Quote:[syntax="QBASIC"]INPUT "Your weight? ", weight
PRINT "Your weight in space is"; weight * 0[/syntax]

Shhhhhhhhhhhhhhhhhh
Sorry had to :roll:

Not really. It depends upon your proximity to a source of gravity =P.

rhoward: Its a good practice to declare the variables before you start off using them. If you dont want to declare them then you can add a suffix to indicate their type. For eg. Strings - $, Integer - %, Single precision - !, Double Precision - &

Quote:cls
input "Input Friends Name", nameA$
input "Input Friends Weight", weight1!

'planets gravity
mercury! = .27
venus! = .85
earth! = 1
moon! = .16
mars! =.18
jupiter! = 2.64
saturn! = 1.17
uranus! = .92
neptune! = 1.12



Weight in Space input problem - Z!re - 12-02-2004

Default type in QB is single... thus ! is not needed unless you use defint, deflng, defstr


Re: Weight in Space input problem - Nemesis - 12-06-2004

Code:
cls
input "Input Friends Name";nameA
input "Input Friends Weight";weight1

'planets gravity
mercury = .27
venus = .85
earth = 1
moon = .16
mars =.18
jupiter = 2.64
saturn = 1.17
uranus = .92
neptune = 1.12

Cry What about Pluto? Cry


Weight in Space input problem - Jofers - 12-06-2004

Nobody cares about pluto. "Weightlessness" has nothing to do with being far away from earth. "g" is still 8.something in orbit, it's the centripital force of the craft in orbit countering gravity that makes you weightless.

So long as there is other matter in the universe, you can't really be weightless.


Weight in Space input problem - Nemesis - 12-06-2004

Quote:Nobody cares about pluto.

Oh, should I ask this Nobody guy then?

Where can I get in touch with Nobody?

Jofers, please reply as soon as possible!

Thanks,

Nemesis


Weight in Space input problem - TheBigBasicQ - 12-06-2004

I thought you were Mr.Nobody! :rotfl: