Question: In c++ Write a function that takes a 12-character string specifying the phone number in E.164 format and returns the local phone number as a
In c++ Write a function that takes a 12-character string specifying the phone number in E.164 format and returns the local phone number as a string. Heres a description of what this function does:
Country code = 1. The first two digits will be +1, followed by a three-digit area code, and the remaining 7 digits specify the subscriber number. Your function should format the number using parentheses around the area code, and dashes between the area code and the two parts of rest of the number. o EXAMPLE: The E.164 format for the main number is +12012812000. Your function should return (201)-281-2000. Country code = 33. The first three digits will be +33, followed by nine digits. When you format the number, you will prepend a 0 digit to the start. You should insert a space character between each pair of digits. o EXAMPLE: The E.164 format for the Louvre Museum phone number is +133140205990. Your function should return 01 40 20 59 90. Country code = 852. The first four digits will be +852, followed by eight digits. When you format the number, you will insert a space character between the two 4-digit pairs of numbers. o EXAMPLE: The E.164 format for the Star Ferry phone number is +85223677065. Your function should return 2367 7065.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
