76 412
Assignments Done
Successfully Done
In May 2019

Answer to Question #50072 in C++ for Umer Inayat

Question #50072
A phone number, such as (212) 767-8900, can be thought of as having three parts: the
area code (212), the exchange (767), and the number (8900). Write a program that uses a
structure to store these three parts of a phone number separately. Call the structure
phone. Create two structure variables of type phone. Initialize one, and have the user
input a number for the other one. Then display both numbers. The interchange might
look like this:

Enter your area code, exchange, and number: 415 555 1212
My number is (212) 767-8900
Your number is (415) 555-1212
Expert's answer
#include <iostream>
#include <string>
using namespace std;

struct phone
string part1;
string part2;
string part3;

int main( )
phone first, second;
cout<<"Enter your area code,exchange, and number: ";

cout<<"My number is("<<second.part1<<")

cout<<"My number is("<<first.part1<<")

return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions