AboutAlex Barry Expertise I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.
Experience Hobby programming since 2000
I no longer belong to any community programming groups, but do have knowledge of *basic dialects and C/C++
Question I'm taking classes for a 9th grade student from a different school. She's got the following code for accepting user entry from her teacher at school. But i'm not aware of anything of the sort in qbasic. Pl. help !
a=val(text1.text)
if a mod 2=0 then
print "The number entered is an even number"
else
print "The number entered is an odd number"
endif
why are they using text1.text and not INPUT to acept a number from the user ?? More importantly, is text1.text allowed in Qbasic ???
Please Help !
Answer Hi, Smitha,
text1.text is definately a variable, but just how it is written, it looks like it is more likely from Visual Basic, opposed to QBasic.
Either way, you could change that to this:
DIM text AS STRING
DIM a AS INTEGER
INPUT "Number: ", text
a = VAL( text )
IF ( a MOD 2 ) = 0 THEN
PRINT "The number entered is an even number"
ELSE
PRINT "The number entered is an odd number"
END IF
I hope that answers your question. Again, you may want to look into the class to see if it is teaching QBasic or Visual BASIC