EasyManuals Logo

Atari 65XE User Manual

Atari 65XE
135 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #61 background imageLoading...
Page #61 background image
30 PRINT
40 PRINT "YOUR GUESS";
50 INPUT GUESS
60 PRINT
70 IF GUESS=SECRETNUM THEN PRINT "YOU GOT IT ! " : END
80 IF GUESS<SECRETNUM THEN PRINT "TOO LOW. TRY AGAIN. " :
GOTO 40
90 IF GUESS>SECRETNUM THEN PRINT "TOO HIGH.TRY
AGAIN.":GOTO 40
Lines 80 and 90 evaluate the guess as greater than or less than the
secret number. The PRINT statement provides a hint that the next
guess should be higher or lower. The GOTO commands in lines 80 and
90 create an infinite loop if you continue to guess incorrectly.
Ending the Program
The Number Quiz is programmed to stop only when you discover the
secret number. When you enter the correct answer, line 70 gives the
computer the instruction to end. END stops the program, and the
Ready prompt appears on your screen.
Trapping Errors
If you accidentally enter a letter instead of a number for GUESS, the
computer sends an Error message, and the program ends abruptly.
Make an intentional error by typing a letter key or pressing the
key only. To avoid ending the program, you can use a TRAP command
to trap the Error message. Add the lines below and run the program
again:
45 TRAP 100
100 PRINT:PRINT "PLEASE ENTER A NUMBER ONLY. "
110 GOTO 30
In line 45, the TRAP command tells the computer not to stop the
program when a mistake is entered and sends the computer to line
100. Line 100 tells the computer to print the directions for correcting
the mistake. Line 110 returns the computer to the place where it left
off. The TRAP statement always comes before the INPUT statement,
and it always contains the number of the line that will resolve the
problem.
Quiz Writing with IF-THEN
A program can easily provide hints when the correct answer is a
number, including a date. The following program uses IF-THEN
statements and the TRAP command to evaluate guesses:
56

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atari 65XE and is the answer not in the manual?

Atari 65XE Specifications

General IconGeneral
CPUMOS Technology 6502C
CPU Speed1.79 MHz (NTSC) / 1.77 MHz (PAL)
RAM64 KB
ROM16 KB
Release Year1985
GraphicsANTIC and GTIA
Display Resolution320x192
SoundPOKEY sound chip, 4 channels
Operating SystemAtari BASIC
PortsJoystick, Cartridge
StorageExternal 5.25" floppy disk drive

Related product manuals