TI-92+ Programming Tutorial
BASIC Lesson 1-Inputs and Outputs
Name your program. Choose a name that will explain what you program does, remember your program's name must be 8 characters or less. The first program that I am using to show some examples is called Example(). To start your program press: [APPS], 7: Program Editor, 3: New, input the name: Example, and press [ENTER] twice.
Now, the program screen says:
:example()
:prgm
:
:endprgm
Now display your program's name on the I/O screen using the Disp command, the text that you want to display needs to be put in quotation marks:
:example()
:prgm
:Disp "Example"
:endprgm
Put your name underneath the title:
:example()
:prgm
:Disp "Example"
:Disp "By: Ryan Pelletier"
:endprgm
Ask the person who is running the program to enter their name using the Disp and Input command:
:example()
:prgm
:Disp "Example"
:Disp "By: Ryan Pelletier"
:Disp "Enter your name"
:Input a
:endprgm
Now that that persons name is stored as variable "a", you need to localize variable "a" so it automaticlly deletes itself after the program is ended:
:example()
:prgm
:local a
:Disp "Example"
:Disp "By: Ryan Pelletier"
:Disp "Enter your name"
:Input a
:endprgm
The next program will be an example of a math formula program. The commands used are the same with a few new ones. This program will be the area of a rectangle.
Name your program:
:math()
:prgm
:
:endprgm
Display what your program does:
:math()
:prgm
:Disp "Area of a rectangle"
:endprgm
Ask the person to enter the length and width and set the dimentions to variables:
:math()
:prgm
:Disp "Area of a rectangle"
:Disp "Enter length"
:Input l
:Disp "Enter width"
:Input w
:endprgm
Now you must tell the calculator what to do with the two variables that were just entered. Store the answer as another variable:
:math()
:prgm
:Disp "Area of a rectangle"
:Disp "Enter length"
:Input l
:Disp "Enter width"
:Input w
:l*w->a
:endprgm
Display the variable "a":
:math()
:prgm
:Disp "Area of a rectangle"
:Disp "Enter length"
:Input l
:Disp "Enter width"
:Input w
:l*w->a
:Disp a
:endprgm
Now, as before, local the variables you used (a, l, and w):
:math()
:prgm
:local a,l,w
:Disp "Area of a rectangle"
:Disp "Enter length"
:Input l
:Disp "Enter width"
:Input w
:l*w->a
:Disp a
:endprgm
To make you program more "presentable" use the request and expr() commands:
:math()
:prgm
:local a,l,w
:Disp "Area of a rectangle"
:Request "Enter length",l
:expr(l)->l
:Request "Enter width",w
:expr(w)->w
:l*w->a
:Disp a
:endprgm
Using Dialog boxes to give your programs a finished edge:
:math()
:prgm
:local a,l,w
:Dialog
:Text "Area of a rectangle"
:Request "Enter length",l
:Request "Enter width",w
:EndDlog
:expr(w)->w
:expr(l)->l
:l*w->a
:Dialog
:Text "Area="
:Text a
:EndDlog
:endprgm