g a string into two parts based on a delimiter has applications. For example, given an email address, breaking it based on the delimiter "@" gives you the two parts, the mail server's domain name and email username. Another example would be separating a phone number into the area code and the rest. Given a phrase of string and a delimiter string (shorter than the phrase but may be longer than length 1), write a C++ function named break_string to break the phrase into two parts and return the parts as a C++ std::pair object (left part goes to the "first" and right part goes to the "second").
g a string into two parts based on a delimiter has applications. For example, given an email address, breaking it based on the delimiter "@" gives you the two parts, the mail server's domain name and email username. Another example would be separating a phone number into the area code and the rest. Given a phrase of string and a delimiter string (shorter than the phrase but may be longer than length 1), write a C++ function named break_string to break the phrase into two parts and return the parts as a C++ std::pair object (left part goes to the "first" and right part goes to the "second").
Related questions
Question
Question 1: break phrase
Problem statement
Breaking a string into two parts based on a delimiter has applications. For example, given an email address, breaking it based on the delimiter "@" gives you the two parts, the mail server's domain name and email username. Another example would be separating a phone number into the area code and the rest.
Given a phrase of string and a delimiter string (shorter than the phrase but may be longer than length 1), write a C++ function named break_string to break the phrase into two parts and return the parts as a C++ std::pair object (left part goes to the "first" and right part goes to the "second").

Transcribed Image Text:Test
#
1
2
3
4
input
phrase =
msmith@gmail.com du";
delemeter = "@";
phrase = "408-345-0000";
delemeter = "-":
"
Output (Need
to print 2 parts
of the std::pair
phrase = "Teachers open the
door, but you must enter by
yourself - Chinese Proverb";
delemeter = "_"
object)
The first part:
msmith
The second
part:
gmail.com
The first part:
408
The second
part: 345-0000
The first part:
An investment
in knowledge
pays the best
phrase = "An investment in
knowledge pays the best
interest. - Benjamin Franklin"; interest.
delemeter = "-
The second
part: Benjamin
Franklin
The first part:
Teachers open
the door, but
you must enter
by yourself
The second
part: Chinese
Proverb
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
