Computer Science Canada how would I break a sentance into variables per word |
Author: | pozaj0206 [ Mon Dec 12, 2011 8:20 pm ] | ||
Post subject: | how would I break a sentance into variables per word | ||
What is it you are trying to achieve? I am trying to make a simple translator. What is the problem you are having? I don't know how I can have a whole sentence as input the have it split to variables word1, word2 ect. IE. I type "hello how are you" and it makes Engword1 = hello Engword2 = how Engword3 = are Engword4 = you Describe what you have tried to solve this problem I have tried collecting each word at a time but I find its a bit inconvenient. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) here's a code snippet
Please specify what version of Turing you are using 4.1 |
Author: | Tony [ Mon Dec 12, 2011 8:24 pm ] | ||
Post subject: | RE:how would I break a sentance into variables per word | ||
|
Author: | pozaj0206 [ Mon Dec 12, 2011 9:27 pm ] | ||
Post subject: | Re: RE:how would I break a sentance into variables per word | ||
Tony @ Mon Dec 12, 2011 8:24 pm wrote:
ok, thanks tony but 1 question how exactly can I apply this to turing? like is full_sentence just a variable? and whats the : for? thx |
Author: | Tony [ Mon Dec 12, 2011 9:32 pm ] |
Post subject: | RE:how would I break a sentance into variables per word |
you can read up on the details in Turing's documentation -- get |
Author: | Velocity [ Mon Dec 12, 2011 9:48 pm ] |
Post subject: | RE:how would I break a sentance into variables per word |
the " :* " pretty much just allows the user to break the string and input a sentence with spaces into one line of code Example : CODE : var full_name : string put "What is your full name? " .. get full_name : * put full_name Input : Roger bobby booshay kristoph Output :Roger bobby booshay kristoph but if you didnt have the " :* " it would be an error saying that you broke the string |
Author: | Velocity [ Mon Dec 12, 2011 9:50 pm ] |
Post subject: | RE:how would I break a sentance into variables per word |
so like if you didnt have the " :* " it would say Output : Roger because it only sees the first word that you entered. |
Author: | pozaj0206 [ Tue Dec 13, 2011 3:33 pm ] |
Post subject: | Re: how would I break a sentance into variables per word |
thx |