Question: 2. Write a program named LastNamePhone that asks the user for their phone number in the form XXX-XXX-XXXX, and determines whether or not the

  • 2. Write a program named LastNamePhone that asks the user for their 

2. Write a program named LastNamePhone that asks the user for their phone number in the form XXX-XXX-XXXX, and determines whether or not the number is real (not enough or too many digits) or if it matches any of the numbers from the movies (middle 3 digits 555). In addition, check that they put in the -'s in the correct locations. Let the user know why it isn't a number if it isn't a number. (Bonus if you also check to make sure each group of 3 or 4 numbers is actually numbers). Examples: Enter your phone number: 123-456-7890 That is a legit number! Enter your phone number: 123-555-1234 That is a number from a movie!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include include include usingnamespacestd boolisValidPhoneNumberconststringphone... View full answer

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 Operating System Questions!