• Please review our updated Terms and Rules here
  • Exhibitor application for VCF West 2022 is now open! If you are interested in exhibiting, please fill out the form here.
  • Here are the results of the VCF East 2022 Post Event Survey: Survey Results

New BASIC program

Edlin

Experienced Member
Joined
Nov 26, 2006
Messages
115
Location
Oklahoma
Here is a letter guessing game in basic

10 REM Letter - guessing game in BASIC
20 REM Generate a random number from 65 to 90
30 REM (ASCII 65 is A and ASCII 90 is Z)
40 NUM = (INT(RND * 26)) + 65
50 CA$ = CHR$(NUM)
60 CLS
70 PRINT "*** Letter Guessing Game ***"
80 PRINT
90 PRINT "I am thinking of a letter..."
100 INPUT "What is your guess"; UG$
110 TR = TR + 1
120 IF (UG$ > CA$) THEN GOTO 150
130 IF (UG$ < CA$) THEN GOTO 180
140 GOTO 210
150 PRINT "Your guess was too high"
160 PRINT "Try again..."
170 GOTO 200
180 PRINT "Your guess was too low"
190 PRINT "Try again..."
200 GOTO 100
210 REM Here if guess was correct
220 PRINT "***Congratulations! You got it right!"
230 PRINT "It took you only"; TR; "tries to guess."
240 END
 
Last edited:

Edlin

Experienced Member
Joined
Nov 26, 2006
Messages
115
Location
Oklahoma
Word Guessing Game

Word Guessing Game

For those who are interested, you will have to have basic or qbasic, you run this program and then you will have to give a name to your newly created program, I'd suggest word.bas, then from qbasic choose run word.bas and it should work, very limited, but it works. Also, your answer needs to be in capital letters.
 
Last edited:

DoctorPepper

Experienced Member
Joined
Jun 19, 2003
Messages
479
Location
Palm Coast, FL
Here is a letter guessing game in basic

10 REM Letter - guessing game in BASIC
20 REM Generate a random number from 65 to 90
30 REM (ASCII 65 is A and ASCII 90 is Z)
40 NUM = (INT(RND * 26)) + 65
...
240 END

Sandy, I'd recommend putting a "RANDOMIZE seed" statement (where 'seed' is your seed value (like TIMER)) between line 30 & 40, otherwise, your random number generator will generate the same number each time the program is run. At least when using QBASIC on a PC.
 

Edlin

Experienced Member
Joined
Nov 26, 2006
Messages
115
Location
Oklahoma
Thanks Doc

Thanks Doc

It's been a long time... S was the only right answer in it.
 
Top