GSAC3
24-01-2009, 00:23
Eros:
In the following code, I am trying to read in and then print out data entered from the keyboard, but I am not getting the correct results (at least not what I am expecting to get).
'
Uses "Console"
DIM Z AS STRING
DIM D AS INTEGER
PRINTL ("ENTER number (e.g. 1) ")
Z = GETS()
PRINTL (Z)
D = VAL(Z)
PRINTL Str$(D)
SLEEP (5000)
When I enter a numerical value, say 1, from the keyboard, the string value printed out by the code is 0 (zero) instead of 1. I believe I am following the documentation correctly for using GETS(), VAL(Z), and Str$(D), but I must be doing something wrong. I am using version 1.7.5.0.
Don
In the following code, I am trying to read in and then print out data entered from the keyboard, but I am not getting the correct results (at least not what I am expecting to get).
'
Uses "Console"
DIM Z AS STRING
DIM D AS INTEGER
PRINTL ("ENTER number (e.g. 1) ")
Z = GETS()
PRINTL (Z)
D = VAL(Z)
PRINTL Str$(D)
SLEEP (5000)
When I enter a numerical value, say 1, from the keyboard, the string value printed out by the code is 0 (zero) instead of 1. I believe I am following the documentation correctly for using GETS(), VAL(Z), and Str$(D), but I must be doing something wrong. I am using version 1.7.5.0.
Don