string task

so i need help . We have 2 strings. We have to delete every little string which is contained in string №2 . for example : "Hello there", "llo" → "He there"
"Hello there", "e" → "Hllo thr"
"Hello there", "x" → "Hello there"
Thanks in advance
So have you figured out (for example) how to find "llo" within "Hello there" ?

You need to post some actual attempt at solving problems.
Just dumping your assignment with zero effort isn't good enough.
Im not very good at it . I will try to explain it better . So We have string 1 , and string 2 . like this . cin >> str1 >> str2; str1 = Hello; str2 = llo; if there is string 2 in string 1 . We have to cut it out . Tried my best :P
closed account (E0p9LyTq)
So where is your actual code?

Do you know how to search in a string for substrings?

Are you using C-style char strings or C++ std::strings?

Im not very good at it . I will try to explain it better
Show what code you've written so far. We won't do your assignment for you.
I won't do it for you either, but how about a hint or two:
look at string::find and string::substr.

the documentation online for those will have clean examples to do exactly what you asked.
Last edited on
Topic archived. No new replies allowed.