I get 2 strings. I remove all the characters present in both the 2 strings.I count the no. of characters left. How do i do this in C++?
chound
1
Junior Poster
Recommended Answers
Jump to PostHi Chound,
I would like to help out but could you clarify your question a bit and post what you've got so far?
Do you mean C string or C++ string?
If you have 2 strings and you "remove all the characters present in both the 2 …
Jump to Postuse the two functions clear() and length()
string str1 = "Judges live on income"; string str2 = " fixed"; cout << "before clear: " << str1.length() << endl; str1.clear(); cout << "after clear: " << str1.length() << endl; // now do the same thing with str2
Jump to PostWhat are the params for find() and erase()?
Look at the code snippet "Playing around with std::string" here on DaniWeb under:
http://www.daniweb.com/code/snippet117.html
Both erase() and find() are shown. You have to use a few if statements to get your work done.If you want more than a good exercise …
All 9 Replies
jimFan
0
Newbie Poster
jimFan
0
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
chound
1
Junior Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
chound
1
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
jimFan
0
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.