Ti-83 Programming Tutorials
|
|
Chapter 2 - Basic Input/Output
Inputs and outputs are essential to nearly all programs. Most programs will need
input from the user and most will have information that needs to be displayed to
the user.
Screen Dimensions
Before we can get input and output, we need to know a few things first: screen size.
You have the option of using two display modes on the Ti-83 calculator: the default "homescreen"
display mode or the graph display. Each display has advantages and disadvantages (shown below).
Home screen | Graph Display |
16 columns by 8 rows | 94 pixels by 62 pixels |
Advantages |
Simple input and output routines Large font |
Drawing functions More space to work with |
Disadvantages |
Smaller screen space No drawing functions |
Displaying text requires exact pixels Non-monotype font No built-in input feature (besides getKey) |
Variables
Variables store data. For example, if you were to input your name, the name might be
stored as a string. You can store numbers, like how much money you have in a poker game,
into variables. Variables are an essential part of Ti-83 programming, as nearly all TI-83
programs use variables in one form or another. A list of variable types is provided below.
- Single Variables
- This includes all the variables from A to Z, theta, and other settings variables. You can store numbers in these variables. To access these variables, press [ALPHA] and then the button corresponding to the variable letter.
- Strings
- You have 10 strings to work with (Str0 to Str9). You can access these strings under the [VARS]-(7:String) menu. Unsurprisingly, you can store strings in these string variables (remember to include double-quotes around your string, though).
- Lists
- Lists include the standard L1 to L6 and custom strings. You can store an array (a sequence) of numbers in strings. Unlike other variables, you can create your own lists! This is quite beneficial to have when creating 'high score' features because you can store the high score onto a list without worry that it will be deleted by another program.
- Matrices
- Matrices are simply two-dimensional lists. The available matrices are [A] to [J].
- Others
- There are more variables you can use (like the Y-Function variables), but for the most part you will be using single variables, lists, matrices, and strings.
- Ans
- The Ans variable is unique. It contains the answer from the last processed command and can be a number, a string, a list, or a matrix. You can't store data onto Ans but it is still a powerful variable. We will discuss the usage of Ans in later tutorials.
|
Output
Clearing the screen
You can clear the home screen with the command ClrHome.
Displaying text
To display text on the home screen, use the Output or Disp command. You will learn how to display smaller text onto the graph display in a later tutorial.
- Output
- Output(row, column, string/number) : row - from the top of the screen being 1 to the bottom being 8; column - from the left of the screen being 1 to the right being 16; string - the string you wish to display. The string will wrap around to the next row if the part of the string goes pass the 16th column. You can also use Output to display numbers and variables.
- Disp
- Disp string[, string, string] : string - the string to display. The string does NOT wrap around if it is to more than 16 characters in length. You can also use numbers,variables, lists, or matrices in place of the string. You can also add more strings or variables, separating them with a comma, if you want to display more than one line of information.
Input
Getting user input is quite simple. The three basic input methods are Input, Prompt, and getKey.
- Input
- Input "Optional Display",Variable : the variable may be stored in a string variable or a single variable. You can omit the first put and just have Input Variable.
- Prompt
- Prompt Variable[,variable, variable] : You can prompt for a series of inputs to be stored in variables (string or single variable).
- getKey
- This returns a number corresponding to a key that was just pressed. You may want to store it in a variable (getKey->K) for use in conditional statements, or access it with the Ans variable (but keep in mind that Ans may be overwritten by another line of code).
|
|