i am writing a program where the user has to input information in words, and my question is how do i make the letters in the word appear one after another and on the same line as the question? and how do i make it so if they type a word then it does something specific?
how do i?
Started by
Bob Vila
, Jul 07 2003 04:08 PM
7 replies to this topic
#1
Posted 07 July 2003 - 04:08 PM
#2
Posted 08 July 2003 - 01:33 AM
Im not sure if i understand, but here is what you need to input "words":
that will collect the word into a list which you can interpret into individual letters which can be printed. 31 is used as a terminator, when you display your letters 31 will be the que to quit.
Here is the code to display the text the user entered.
if you want to check if a specific word was entered I suggest making another list filled with the GetKey values for the letters to check for, then compare the two lists. heres the code:
Addmitedly this is not the best way to do this, but it is the easyest to understand, hope it helps.
PS: glad to see your writing a program.
1->A Dim (#+1)->List 1 //# should be max size of word Do Do LpWhile getkey=0 Getkey->G G->List 1[A] Isz A LpWhile getkey<>31 And A<>Dim List 1 31->List 1[Dim List 1] //insures that 31 will always be at the end of the list
that will collect the word into a list which you can interpret into individual letters which can be printed. 31 is used as a terminator, when you display your letters 31 will be the que to quit.
Here is the code to display the text the user entered.
#->X #->Y 1->A While List 1[A]<>31 List 1[A]->L L=#=>Locate X+(A-1),Y,"A" //# should be the GetKey value for each letter L=#=>Locate X+(A-1),Y,"B" L=#=>Locate X+(A-1),Y,"C" ... ... L=#=>Locate X+(A-1),Y,"Z" Isz A WhileEnd
if you want to check if a specific word was entered I suggest making another list filled with the GetKey values for the letters to check for, then compare the two lists. heres the code:
this might work, I dont remember: List 1=List 2=>{CODE} if not then: 0->B For 1->A to Dim List 1 List 1[A]<>List 2[A]=>1->B Next B=0=>{CODE}
Addmitedly this is not the best way to do this, but it is the easyest to understand, hope it helps.
PS: glad to see your writing a program.
#3
Posted 08 July 2003 - 01:42 PM
thanks crimson just what i needed
#4
Posted 08 July 2003 - 02:35 PM
Your welcome, what is this program going to be?
#5
Posted 08 July 2003 - 04:27 PM
well i dont know yet but i was messing around trying to get that input stuff working, because i'm sure i will use it what ever i plan to do.
#6
Posted 10 July 2003 - 01:47 PM
hey crimson, it has an error on this command
i have tried to put the number and the # in and i think it has a syn error, what shoul i do?
Dim (#+1)->List 1 //# should be max size of word
i have tried to put the number and the # in and i think it has a syn error, what shoul i do?
#7
Posted 10 July 2003 - 02:22 PM
sorry, I wrote that wrong, heres how it should be:
(#+1)->Dim List 1
#8
Posted 13 July 2003 - 11:40 PM
thanks
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users