Qbasicnews.com

Full Version: Weight in Space input problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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.
[syntax="qbasic"]cls
input "Input Friends Name";nameA$[/syntax]

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

Oz~
Or, at the start:
[syntax="qbasic"]dim nameA as string[/syntax]
[syntax="QBASIC"]INPUT "Your weight? ", weight
PRINT "Your weight in space is"; weight * 0[/syntax]

Shhhhhhhhhhhhhhhhhh
Sorry had to :roll:
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
Default type in QB is single... thus ! is not needed unless you use defint, deflng, defstr
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
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.
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
I thought you were Mr.Nobody! :rotfl:
Pages: 1 2