C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-26-2006, 07:28 PM   #1
Registered User
 
Join Date: Nov 2006
Posts: 3
Post Programming using strings

Hi I'm sorry I new to this, and I've been trying to program this all day, I don't know what I'm doing, I can't get my out put or run to work, please help me out on just this problem, I sware I won't bother anyone with hw again



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   Reply With Quote
Old 11-26-2006, 07:36 PM   #2
MFC killed my cat!
 
manutd's Avatar
 
Join Date: Sep 2006
Location: Boston, Massachusetts
Posts: 880
No, we won't do your homework for you. Show some effort.
__________________
Silence is better than unmeaning words.
- Pythagoras
My blog
manutd is offline   Reply With Quote
Old 11-26-2006, 07:49 PM   #3
In the Land of Diddly-Doo
 
g4j31a5's Avatar
 
Join Date: Jul 2006
Posts: 373
Word of advice: "use std::string". Read the tutorials in this web for further readings.
g4j31a5 is offline   Reply With Quote
Old 11-26-2006, 07:54 PM   #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   Reply With Quote
Old 11-26-2006, 08:04 PM   #5
(?<!re)tired
 
Mario F.'s Avatar
 
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   Reply With Quote
Old 11-26-2006, 08:07 PM   #6
Registered User
 
Join Date: Nov 2006
Posts: 3
whatever....
jlu0418 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 11:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22