#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
struct date
{
int dd,mm,yy;
};
class employ
{
private:
int number;
char name[20];
char designation[20];
double salary;
date dob,doj;
public:
employ():number(0) //constructor
{}
~employ(){} //destructor
void input()
{
cout<<"enter employ number:";
cin>>number;
cin.ignore(10,'\n');
cout<<"enter name:";
cin.get(name,20);
cin.ignore(10,'\n');
cout<<"enter designation:";
cin.get(designation,20);
cout<<"enter salary:";
cin>>salary;
cout<<"enter date of birth:\n";
cout<<"enter date:";
cin>>dob.dd;
cout<<"enter month:";
cin>>dob.mm;
cout<<"enter year:";
cin>>dob.yy;
cout<<"enter date of joining:\n";
cout<<"enter date:";
cin>>doj.dd;
cout<<"enter month:";
cin>>doj.mm;
cout<<"enter year:";
cin>>doj.yy;
}
void display()
{
cout<<"\n\n\n"<<"employ number:"<<number<<"\n"<<"name:"<<name<<"\n"<<"designation:"<<designation<<"\n"<<"salary:"<<salary<<"\n";
cout<<"date of birth:"<<dob.dd<<"."<<dob.mm<<"."<<dob.yy<<"\n"<<"date of joining:"<<doj.dd<<"."<<doj.mm<<"."<<doj.yy;
}
};
enum {size=50};
employ e[size];
void main()
{
clrscr();
int i,j,m,k,l;
char op;
do
{
cout<<"enter a to input b to delete any employ record c to insert employ record at any point and q to quit\n";
cout<<"enter your choice:";
cin>>op;
switch(op)
{
case 'a':
for(i=0;i<=size;i++)
{
e[i].input();
cout<<"want to continue y\n";
if(getch()!='y')
break;
}
break;
case 'b':
cout<<"enter pos to delete record ";
cin>>k;
for(m=k;m<=i;m++)
e[m]=e[m+1];
break;
case 'c':
cout<<"enter pos to insert record";
cin>>l;
for(m=i;m>=l+1;m--)
{
e[m+1]=e[m];
}
e[m].input();
break;
case 'd':
for(j=0;j<=i;j++)
e[j].display();
break;
default:
cout<<"invalid choice";
}
}
while(getche()!='q');
getch();
}