
-----------------------------------
pozaj0206
Mon Dec 12, 2011 8:20 pm

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



var Engword1 : string := ""
var Engword2 : string := ""
var Engword3 : string := ""
var Engword4 : string := ""
var Engword5 : string := ""

loop
put "Type the sentence that you wish to translate (max 10 words, no caps, no punctuation)"
get Engword1

if Engword1 = "hello"
then Dovword1 := "Bonjour"
cls



Please specify what version of Turing you are using
4.1

-----------------------------------
Tony
Mon Dec 12, 2011 8:24 pm

RE:how would I break a sentance into variables per word
-----------------------------------
[code]
get full_sentence : *
[/code]

-----------------------------------
pozaj0206
Mon Dec 12, 2011 9:27 pm

Re: RE:how would I break a sentance into variables per word
-----------------------------------


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

-----------------------------------
Tony
Mon Dec 12, 2011 9:32 pm

RE:how would I break a sentance into variables per word
-----------------------------------
you can read up on the details in Turing's documentation -- [tdoc]get[/tdoc]

-----------------------------------
Velocity
Mon Dec 12, 2011 9:48 pm

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

-----------------------------------
Velocity
Mon Dec 12, 2011 9:50 pm

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.

-----------------------------------
pozaj0206
Tue Dec 13, 2011 3:33 pm

Re: how would I break a sentance into variables per word
-----------------------------------
thx
