
-----------------------------------
Michael
Sun Nov 27, 2005 7:31 pm

help with length function
-----------------------------------
hey people
i have this program 




    var name : string

    put "Questio 2"
    put " "
    put "Please enter your full name:"
    get name

    put "The length of your name is ", length (name)



the problem is.. the length function only counts the characters untill there's a space so now it only displays the first name and not the second name because of the space 
how do i make it so it counts the space and what's after

-----------------------------------
Dan
Sun Nov 27, 2005 7:40 pm


-----------------------------------
the problem is not with the length function but with the gets fuction. It is only inputing the 1st string. 

What you need to do is replace gets name with gets name:* if i rember how to use the gets function in turing right. If that dose not work check the manual on gets and see how to input a line rather then a word.

-----------------------------------
Michael
Sun Nov 27, 2005 7:45 pm


-----------------------------------
yep thanks
just had to add  *  after  get 


    var name : string
    put " "
    put "Please enter your full name:"
    get name : *
var name2 : string := name
    put "The length of your name is ", length(name2)


-----------------------------------
iker
Sun Nov 27, 2005 7:54 pm


-----------------------------------
Your new name2 variable is just a waste of time... You could have just as easily just put

    var name : string
    put "Please enter your full name:"
    get name:*
    put "The length of your name is ", length (name) 

