Example of passing values to a program – Texas Instruments PLUS TI-89 User Manual

Page 301

Advertising
background image

284 Chapter 17: Programming

17PROGRM.DOC TI-89/TI-92 Plus: Programming (English) Susan Gullord Revised: 02/23/01 1:14 PM Printed: 02/23/01 2:18 PM Page 284 of 40

The following program draws a circle on the Graph screen and then
draws a horizontal line across the top of the circle. Three values
must be passed to the program:

x

and

y

coordinates for the circle’s

center and the radius

r

.

¦

When you write the program in the Program Editor:

In the ( ) beside the program
name, specify the variables
that will be used to store the
passed values.

Notice that the program also
contains commands that set
up the Graph screen.

:circ(x,y,r)
:Prgm
:FnOff
:ZoomStd
:ZoomSqr
:Circle x,y,r
:LineHorz y+r
:EndPrgm

Before drawing the circle, the program turns off any selected
Y= Editor functions, displays a standard viewing window, and
“squares” the window.

¦

To run the program from the Home screen:

The user must specify the
applicable values as
arguments within the ( ).

The arguments, in order, are
passed to the program.

circ(0,0,5)

Example of Passing
Values to a Program

Note: In this example, you
cannot use circle as the
program name because it
conflicts with a command
name.

Note: This example
assumes that the user
enters values that can be
displayed by the viewing
window set up by ZoomStd
and ZoomSqr.

Passed to r.

Passed to y.

Passed to x.

Only circ( ) is
initially displayed
on the blank
template; be sure
to edit this line.

Advertising
This manual is related to the following products: