Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

  1. Home

Write a program that uses a structure to store these 3 parts of a phone no. separately call structure phone create two structure variable of type phone. Initialize one and have the input from user for another no. and display both the nos.



#include<iostream.h>
#include<conio.h>
struct phone
{
int areacode,exno,num;
};
int main()
{
struct phone p1,p2;
clrscr();
cout<<" ";
p1.areacode=212;
p1.exno=456;
p1.num=2809;
cout<<"My no is: "<<"("<<p1.areacode<<")"<<p1.exno<<"-"<<p1.num;
cout<<"\n";
cin>>p2.areacode>>p2.exno>>p2.num;
cout<<"Your no is: "<<"("<<p2.areacode<<")"<<p2.exno<<"-"<<p2.num;
return 0;
} 


Output


Previous
Next Post »