Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 STring Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mallardrocker




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: 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.
mallardrocker




PostPosted: Wed Oct 03, 2007 10:41 pm   Post subject: Re: STring Help

what do u mean the lenght function you mean,

length (word)
Euphoracle




PostPosted: 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()
CodeMonkey2000




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: