09-18-2022, 11:04 PM
This is probably the oldest BASIC game I've ever made back in High School in the 80's. I was bored today so I threw it together again with QB64.
Guess the computer's number from 1 to 100. It adds up how many tries you take.
Guess the computer's number from 1 to 100. It adds up how many tries you take.
Code: (Select All)
start:
Randomize Timer
number = Int(Rnd * 100) + 1
tries = 0
Cls
Do
Print: Print
tries = tries + 1
Print tries; ". ";
Input "Guess My Number (1-100): ", g
If g = number Then
Print: Print "Correct!"
Print: Print "It took you "; tries; " tries."
Print: Input "Again (Y/N)?", ag$
If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
End
End If
If g > number Then Print: Print "Your number is too high."
If g < number Then Print: Print "Your number is too low."
Loop