Question: Write a function, named format_phone_number, that takes in a const reference to a string and returns a new string. The input string is phone number

Write a function, named "format_phone_number", that takes in a const reference to a string and returns a new string. The input string is phone number form of " XXX XXXX " where there can be whitespace before, after, and in the middle of the two parts of the local phone number. The output phone number should be an internationally valid phone number of the form "1+ (517) XXX-XXX".

I recommend using StringStreams in writing your function.

Write a function, named "format_phone_number", that takes in a const reference touse c++

Write function, named "format_phone_number", that takes in a const reference to a string and returns a new string. The input string is phone number form of "XXX XXXX" where there can be whitespace before, after, and in the middle of the two parts of the local phone number. The output phone number should be an internationally valid phone number of the form "1 + [517] XXX-XXX". I recommend using StringStreams in writing your function. #include Using std::string: string format_phone_number (const string &input) { }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!