Computer Science Canada

STring Help

Author:  mallardrocker [ Wed Oct 03, 2007 7:30 pm ]
Post subject:  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

Author:  CodeMonkey2000 [ Wed Oct 03, 2007 7:33 pm ]
Post subject:  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.

Author:  mallardrocker [ Wed Oct 03, 2007 10:41 pm ]
Post subject:  Re: STring Help

what do u mean the lenght function you mean,

length (word)

Author:  Euphoracle [ Thu Oct 04, 2007 7:03 am ]
Post subject:  RE:STring Help

I haven't used turing in a long time, but isn't it str.Length()

Author:  CodeMonkey2000 [ Thu Oct 04, 2007 12:43 pm ]
Post subject:  RE:STring Help

Not in my version.

And yes, I do mean length(word); word being a string variable.


: