TI-Basic Z80 Programming/Input

Input functions accept data from the calculator's user. Input and output functions can be found under  I/O.

Input
Input ( I/O 1) accepts both keyboard and graph point data.

Input without a variable will open the current graph and pause the program. The arrow keys can be used to move the cursor. When is pressed, the variables X and Y will be updated with the X,Y position of the cursor. In PolarGC mode, R and <tt>θ</tt> will be updated instead.

If a variable follows <tt>Input</tt>, the program will accept a value from the keyboard and store it in the variable when is pressed.

If the format  is used, the calculator will display up to 16 user-defined characters before accepting input. If <tt>Strn</tt> is used, <tt>Strn</tt> is string number n, accessed with <tt> 7 n</tt>. Note that <tt>"text"</tt> must be contained in quotation marks (<tt> ["]</tt>).

Examples
This code returns the <tt>X,Y</tt> coordinates of the graph cursor:

This code accepts a value from the keyboard, stores it in the variable called <tt>A</tt>, and displays it:

This code displays what the program is looking for, accepts and stores a numeric value from the keyboard in the variable called <tt>A</tt>. Then <tt>A</tt> is displayed:

Prompt
<tt>Prompt</tt> (<tt> I/O 2</tt>) gets user input for one or more variables at a time. It displays the variable name followed by  for each variable, waiting for keypad input followed by  before continuing. Each value entered is stored in its respective variable.

<tt>Prompt</tt> is useful for quick user input, but should be avoided due to the limitation that only the variable name can be displayed.

Examples
Displays the following:

Displays the following (with user input):

You try it!
Try these examples to practice getting and handling user input.

Pythagorean Theorem
The Pythagorean Theorem states that, for any right triangle with legs A and B and hypotenuse C, $$A^2+B^2=C^2$$. Write a simple program that can calculate the hypotenuse C given values A and B, and display it to the screen. You can use the <tt>Input</tt> or <tt>Prompt</tt> commands.

Because $$A^2+B^2=C^2$$, $$C=\sqrt{A^2+B^2}$$.

Using <tt>Prompt</tt>:

Using <tt>Input</tt>:

Greeting
Write a program that asks the user what their name is, and respond, using their name.

This would appear as (with user input):

Age Calculator
Write a program the allows the user to enter their age in years, then display their age in hours, then in minutes, then in seconds.