Re: TIB: lots of help needed
[Prev][Next][Index][Thread]
Re: TIB: lots of help needed
Here's a thought about your variable situation:
Maybe you could also prompt to find out if the variable exists.
You could try something like:
:6->dimL list1
:Input "Do you know A?",t
:t->exist[1]
:If exist[1]
:Input "What is it?",A
:Input "Do you know B?",t
:t->exist[2]
:If exist[2]
:Input "What is it?",B
.
.
.
:Input "Do you know c?",t
:t->exist[6]
:If exist[6]
:Input "What is it?",c
:
However, I know this is unnecessarily long and can be shortened quite
easily, but here's the result:
If you only know A, B, a, and c, list1 will be {1,1,0,1,0,1}. In this
program segment, no unknown var receives a number. You could define the
necessary function into that variable using the command = (not to be
confused with the test ==; I'm talking about the '85 here)
Further shortening of this program might include using a For loop, a
single variable for the input, a six-character string, "ABCabc", and any
one of the following: two lists containing six elements, one list
containing all info, or a 6X2 matrix.
Here's a tentative example [pardon any inaccuracies]:
...
:6 -> dimL exist
:6 -> dimL vars
:For(x,1,6)
:Input "Do you know "+sub("ABCabc",x,1)+"? ",t
:t -> exist[x]
:If exist[x]
:Input "What is it?",t
:t -> vars[x]
:End
...
Now, in order to tell the calc you do not know the number, you could
either: type 0 every time it asks; store 0 to a variable called 'no' and
1 to 'yes', or whatever you can think of. Note that t stores its
contents into the list 'vars' whether you declare it known or not. It
is up to your program to test the var using the other list 'exist'.
Hope this helps.
Tavis
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Follow-Ups: