Program to find the detail of n customer

Program to find the detail of n customer
//Program to find the detail of  n customer
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct address
{int HNO;
char street[10];
char city[20];
char pin[7];
};
struct date
{int dd;
int mm;
int yy;
};
struct directory
{int ID;
char name[20];
date DOB;
address ADDRESS;
};
void main()
{clrscr();
directory DIRC[10];
int n,id,flag=0;
cout<<"\n Enter the no of customer : ";
cin>>n;
for(int i=0;i<n;i++)
{cout<<"\n Enter customer Id : ";
cin>>(DIRC[i].ID);
cout<<"\n Enter customer name : ";
gets(DIRC[i].name);
cout<<"\n Enter Address  ";
cout<<"\n Enter House No : ";
cin>>DIRC[i].ADDRESS.HNO;
cout<<"\n Enter Street : ";
cin>>DIRC[i].ADDRESS.street;
cout<<"\n Enter City : ";
cin>>DIRC[i].ADDRESS.city;
cout<<"\n Enter Pin : ";
cin>>DIRC[i].ADDRESS.pin;
cout<<"\n Enter date of birth : ";
cin>>(DIRC[i].DOB.dd);
cin>>(DIRC[i].DOB.mm);
cin>>(DIRC[i].DOB.yy);
}
cout<<"\n Enter ID to be Searched : ";
cin>>id;
 for(i=0;i<n;i++)
{if(DIRC[i].ID==id)
{cout<<"\n customer id="<<DIRC[i].ID;
 cout<<"\n customer name="<<DIRC[i].name;
 cout<<"\n customer address=";
 cout<<DIRC[i].ADDRESS.HNO<<","<<DIRC[i].ADDRESS.street<<","
    <<DIRC[i].ADDRESS.city<<","<<(DIRC[i].ADDRESS.pin);
 cout<<"\n customer DOB:";
 cout<<(DIRC[i].DOB.dd)<<"/"<<(DIRC[i].DOB.mm)<<"/"<<(DIRC[i].DOB.yy);
 flag=1;
}
}
if (flag==0)
cout<<"\n not found:";
getch();
}
Program to find the detail of n customer Program to find the detail of n customer Reviewed by SHERE KHOJRAHA on February 16, 2019 Rating: 5

No comments:

Powered by Blogger.