
-----------------------------------
mallardrocker
Wed Oct 03, 2007 7:30 pm

STring Help
-----------------------------------
QUESTION #5

Write a program that will get a string from the user. 

 

First check to see if the string contains an odd number of characters.  If it does, add a space to the end of it (by using string concatenation).

 

Now, output the first half of the string to screen. 

that is the question i have to do, i cant do it, any help woul dbe appreciated thanks

-----------------------------------
CodeMonkey2000
Wed Oct 03, 2007 7:33 pm

RE:STring Help
-----------------------------------
Sigh, the length() function returns the number of characters in the string. x mod y will give you the the remainder between x and y. What you want to check is whether or not length(myString) mod 2 =0.

-----------------------------------
mallardrocker
Wed Oct 03, 2007 10:41 pm

Re: STring Help
-----------------------------------
what do u mean the lenght function you mean,

length (word)

-----------------------------------
Euphoracle
Thu Oct 04, 2007 7:03 am

RE:STring Help
-----------------------------------
I haven't used turing in a long time, but isn't it str.Length()

-----------------------------------
CodeMonkey2000
Thu Oct 04, 2007 12:43 pm

RE:STring Help
-----------------------------------
Not in my version. 

And yes, I do mean length(word); word being a string variable.
