Heaney
Soft
HeaneySoft's BASIC Tutorial
Section 2: Input Statements
In order to understand these explanations better, you might want to have your calculator handy so you can try them out. To start a program for the TI-83, just hit the PRGM button, press the left arrow once, and then push enter. You can name your program whatever you want, the important stuff is what you put in the program.
For the TI-83 there are two basic input statements: Input, and Prompt.
Input:
Input is the better looking of these two input statements, and that's the one I use 100% of the time when I need to input, but that's just a preference of mine. To use Input, have your new program open, and press the PRGM button again, there are three headings at the top of the calculator screen: CTL (control), I/O (input/output), and EXEC (execute a program). For now we're only concerned with the second one, input and output, so press the right arrow once. The first statement you see there is Input, so you can either press 1, or press enter when it's highlighted. Now you will see on your first row of the program the Input statement followed by a space. Now using the alpha button, you want to tell the user what information you need (a form of output). To do this, first put a quotation " then type your message (less than 16 characters) then put an end quotation ". Now put a comma , and finally, the variable you want to store the input to. It should look something like this:
:Input "FIRST NUMBER:",A (press enter to get to the next line)
Now lets do it for B also:
:Input "SECOND NUMBER:",B
Now if you ran the program (exit the programming mode by pressing 2nd and Quit, then run it by pressing PRGM and finding your program in the list), you would see FIRST NUMBER: followed by a flashing box where you input the number. Then when you push enter you would see SECOND NUMBER: followed by a flashing box where you input the second number. For now, the program does nothing more. Lets move on to Prompt.
Prompt:
You can either make a new program, or go back to edit your last one and press CLEAR and DEL a few times. To use Prompt, all we have to do is put it on a line followed by the variable we want to store to. What I don't like about Prompt is the user doesn't know what they're inputting unless you told them before you Prompted. Anyways, the Prompt command is found in the I/O directory below Input. In your program it would look like this:
:Prompt A
And for B:
:Prompt B
Now when you run the program you will see A=? followed by a flashing box where you input the number. Like I said, the user won't always know what A is for. When you input A and press enter you will then see B=? and the flashing box indicating an input.
Then Input statement that we learned about above can actually be used in a similar way as the Prompt statement. If you leave out the words in quotations and take out the comma, leaving just the variable, it will look something like this:
:Input A
So when the program is run you simply see ? followed by the flashing box. Like I said before, I personally like to tell the user what they're inputting, but whatever floats your boat.
Section 1 | Index | Section 3
Comments, Questions, or Ideas: Click Here | Home
Copyright © 2004 HeaneySoft