Thread: TI BASIC help
View Single Post
Old Apr 6th, 2005, 9:28 PM   #17
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
Quote:
Originally Posted by crawforddavid2006
that did not work so i tried something else which helped here is an example

[begining of code]

Disp "UNKOWN=X"
Disp "ENTER A"
Input A
Disp "Enter B"
Input B
Disp "Enter C"
Input C
If C=X
√(A² + B²)→C
If B=X
√(C²-A²)→B
If A=X
√(C²-B²)→A
Disp “Answer Is”
Disp “A”
Disp A
Disp “B”
Disp B
Disp “C”
Disp C
this program isn't going to work because x is a numerical value that is 0 by default. so if the user types in "x" for the variable they don't know, the calculator will interpret it as 0, and you'll have the problem i mentioned earlier. if another program you used stored a different value to x already, say, 14, your output is going to be seriously skewed because the calculator will interpret x as 14--NOT an unknown number.

if what i suggested didn't work, then you probably didn't implement it correctly. try this: replace all instances of "x" with pi. not just 3.14, i'm talking about the pi variable you get when you push 2nd ^. this way, in order to throw the program off the user would physically have to type 3.141592654 (assuming you're in float mode, where decimals don't get rounded).

so the first line would be disp "UNKNOWN=<pi character>" and your if statements would be if A=<pi character> then / if B=<pi character> then / etc.

Last edited by chepfaust; Apr 6th, 2005 at 9:37 PM.
chepfaust is offline   Reply With Quote