space after the N of ON or forgot the period and the space before
TOO BAD!. Those spaces are important. Practice with another string
variable input:
30 DIM NAME$ (1)
170 PRINT "BY THE WAY.. W H A T IS Y O U R NAME";
180 INPUT N A M E $
190 PRINT "WELL, "; NAME$;", I BET YOU WOULD LIKE TO K N O W
HOW MUCH YOU WON . FIRST YOU H A V E TO A N S W E R A QUESTION . "
Run the program. Even though you typed in a full name, the computer
printed only the first initial. That happened because the area
dimensioned in RAM memory for the name was too small. Most
people's names are longer than one character. Change line 30 to a
more reasonable number of spaces and run the program:
30 DIM NAME$ (25)
RUN
Inputting Numeric Variables
So far you have been working with alphanumeric string variables-
variables composed of letters, numbers, or both. For instance, the
computer would accept the name R2-D2 or 007 as a string variable.
However, the number name would be used only as a name, not as a
number in any math problems. Now try some numeric variables that
can be used in mathematical calculations. Numeric variables do not
need a DIM command or a dollar sign. Enter the following program
lines:
20O PRINT:PRINT "HOW OLD A R E YOU";
210 INPUT A G E
220 PRIZE=AGE*1000
23O PRINT : PRINT "YOU H A V E JUST WON $" ; PRIZE ;" F R O M THE
LOTTERY. YOU C A N COLLECT D U R I N G OFFICE HOURS."
In this program, the age that you enter is stored in the numeric
variable called AGE. Line 220 creates another variable called PRIZE.
Line 220' allows the computer's built-in calculator to calculate the
prize money, which is $1000 multiplied by the age of the winner. (To
the computer, * means multiply.) The program does the math for you
and stores the answer in PRIZE. Line 230, which places the numeric
value inside the PRINT statement in the same manner as string
variables, tells you what the answer is.
45
Summary of Contents for 65XE
Page 1: ...ATARI 65XE PERSONAL COMPUTER OWNER S MANUAL TM...
Page 3: ...ATARI 65XE PERSONAL COMPUTER TM...
Page 6: ...Part 1 GettingStarted 1...
Page 9: ...4...
Page 23: ...18...
Page 25: ...20...
Page 32: ...Part 2 Programming withATARI BASIC 27...
Page 33: ...28...
Page 59: ...54...
Page 69: ...64...
Page 82: ...Part3 Appendices 77...
Page 83: ...78...
Page 97: ...92...
Page 105: ...100...
Page 125: ...120...
Page 126: ...121 Index...
Page 127: ...122...
Page 134: ...ATARI 1987 Atari Corp All Rights Reserved Printed in Taiwan C072018 001 REV B K l 2 1987...
Page 135: ......