#include <iostream.h>
#include <conio.h>
#include <stdio.h>struct phone{
int area_code;
int exchange;
int number;
};
struct member{
int member_id;
char name[30];
phone ph_no;
};
void main()
{
member rec[20];
char ch;
cout<<"\n Enter records of 20 members ";
for(int i = 0; i < 20 ; i++)
{
cout<< "\n Member ID ? ";
cin >> rec[i].member_id;
cout<< "\n Enter Name :";
gets( rec[i].name);
cout<< " \n Enter phone number in the format \'areacode - exchange - number (003 - 2442 - 6523)\' :";
cin >> rec[i].ph_no.area_code >> ch >> rec[i].ph_no.exchange >> ch >> rec[i].ph_no.number ;
}
clrscr();
cout<< "\n Member ID \t Member Name \t Ph. No. \n ";
cout<< "--------------------------------------------\n\n";
for(int i = 0; i < 20 ; i++)
{
cout<< rec[i].member_id << "\t" << rec[i].name << "\t" << rec[i].ph_no.area_code<< "-" << rec[i].ph_no.exchange << "-" << rec[i].ph_no.number << endl ;
}
getch();
}
No comments:
Post a Comment