' Draw three circles in the same row ' Ask the user for the row and color to use PRINT "What row do you want" 'statement 1 INPUT ROW 'statement 2 PRINT "What color do you want" 'new statement A INPUT CLR 'new statement B ' SCREEN 12 'statement 3 COLOR CLR 'statement 4 LET RADIUS = 20 'statement 5 ' LET COLUMN = 50 'statement 6 CIRCLE (COLUMN, ROW),RADIUS 'statement 7 ' LET COLUMN = 100 'statement 8 CIRCLE (COLUMN, ROW),RADIUS 'statement 9 ' LET COLUMN = 150 'statement 10 CIRCLE (COLUMN, ROW),RADIUS 'statement 11 ' END 'statement 12
There is a new variable in this program—variable CLR
.
It would be nice to call it COLOR
, but this is
illegal because the name COLOR
is already in use.
Paint programs like the one that comes free with most computers let the user input lots of numbers for describing many figures. Usually the input is done by using the mouse. Here is a (very small) paint program that draws just one circle. Four numbers are needed:
X
value for the center of the circle.Y
value for the center of the circle.RADIUS
of the circle.COLORNUMBER
for the color of the circle.The user is asked for each of these numbers:
' Draw one circle, with center, radius ' and color specified by the user PRINT "Center X (0-639)" INPUT X ' PRINT "Center Y (0-479)" INPUT Y ' PRINT "Radius (0-200)" INPUT RADIUS ' PRINT "Color (1-15)" INPUT COLORNUMBER ' SCREEN 12 COLOR COLORNUMBER CIRCLE (X, Y),RADIUS ' END
In the prompts for the user the range of good values is given. For example, the color number must be 1 through 15, so the prompt says this to help the user decide. The prompts just give good advice; they don't prevent the user from typing in bad values.
Say you wanted to draw a green (color 2) circle of radius 15 at X=200, Y=350. Think about how these values would be entered.