Aim : 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 interaction 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.

Theory Structure:
Theory: We often come around situations where we need to store a group of data whether of similar data types or non-similar data types. We have seen Arrays in C++ which are used to store set of data of similar data types at contiguous memory locations. Unlike Arrays, Structures in C++ are user defined data types which are used to store group of items of non-similar data types. e behavior of objects..

Structures in C++ can contain two types of members:

Data Member:

These members are normal C++ variables. We can create a structure with variables of different data types in C++.

Member Functions:

These members are normal C++ functions. Along with variables, we can also include functions inside a structure declaration. Syntax: struct structureName{
member1;
member2;
member3;
memberN;
};
Program :

Conclusion : Hence we have performed our practical successfully