![]() |
| | #1 |
| Registered User Join Date: Nov 2006
Posts: 3
| The main program will read in one string which consists of two words Ex. "Computer Science" call a function makewords() which receives three parameters: a string which holds the original phrase and two strings to hold the two words. The function will break the string stored in the first parameter (the original sentence) into two words and then store it in one of the parameters. Note: The function can assume there is exactly one space between the words in the sentence. For example, if the original sentence holds: "computer science", then the two words are "computer" and "science”. You should use member functions such as find and substr to help you with this function Your function, makewords(), should then check if the 2 new strings are equal to each other, and print the appropriate message saying whether or not they are equal. print out the two words and their sizes. call the function matchexact() passing the two strings. matchexact() will determine how many times the corresponding positions in the two strings hold exactly the same characters. The function will print this value. For example, if the two strings are "marriage" and "gerbil", then the function matchexact will return 2, since the two strings have the same characters in positions 2 and 5. If the two strings are "starts" and "tarts", then the function will return 0, since the two strings never have the same characters in the same positions. The main program will then call a function jointhem() which receives the two strings. The function will join the two strings together and print the new string. Ex. if string1 is “bath” and string2 is “water” than the new string is “bathwater” Run the program a couple of times showing me different examples. |
| jlu0418 is offline | |
| | #3 |
| In the Land of Diddly-Doo Join Date: Jul 2006
Posts: 373
| Word of advice: "use std::string". Read the tutorials in this web for further readings. |
| g4j31a5 is offline | |
| | #4 |
| Registered User Join Date: Nov 2006
Posts: 3
| I guess you want to see my program, mautd....I told you I've been trying with my Complier, I don't want to be embarrased, I don't know what I'm doing, but thanx I guess for your comment.... and g4j31a5 thanx for the hint, but that still leaves me blank.... sorry i guess |
| jlu0418 is offline | |
| | #5 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,220
| Understand that no one will code this for you. Understand also that no one feels sorry for the fact you didn't pay attention in class. When you get that and show us some code, we will gladly help you fix any mistakes and even throw in the explanation for those mistakes and how to avoid them in the future as a bonus.
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is offline | |
| | #6 |
| Registered User Join Date: Nov 2006
Posts: 3
| whatever.... |
| jlu0418 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strings Program | limergal | C++ Programming | 4 | 12-02-2006 03:24 PM |
| Problem with Strings, Please help! | varus | C++ Programming | 8 | 11-27-2006 11:47 PM |
| Reading strings input by the user... | Cmuppet | C Programming | 13 | 07-21-2004 06:37 AM |
| damn strings | jmzl666 | C Programming | 10 | 06-24-2002 02:09 AM |
| menus and strings | garycastillo | C Programming | 3 | 04-29-2002 11:23 AM |