#include<iostream.h>
/*
void dummy(float *a){
#include<stdio.h>
#include<conio.h>
#define N 5
//apply following code for floating point operation in loop./*
void dummy(float *a){
float
b=*a;
dummy(&b);
}
*/
class employee{
class employee{
int empid;
char
name[20];
float bs,gs,ta,da,hra;
//private function or inline function
void
grosssalary(){
ta=0.25*bs;
da=0.5*bs;
hra=0.1*bs;
gs=bs+ta+da+hra;
}
public:
void
getemp();
void
setemp();
};
void
employee::setemp(){
cout<<"Enter
Employee Details:-"<<endl;
cout<<"Enter
Empid"<<endl;
cin>>empid;
getch();
cout<<"Enter
name"<<endl;
fflush(stdin);
cin>>name;
getch();
cout<<"Enter
Basic Salary"<<endl;
fflush(stdin);
cin>>bs;
getch();
}
void employee::getemp(){
cout<<"Employee Detail:-"<<endl;
cout<<"EmpId="<<empid<<endl<<"Name="<<name<<endl<<"Basic Salary="<<bs<<endl;
grosssalary();
cout<<"TA="<<ta<<endl<<"DA="<<da<<endl<<"HRA="<<hra<<endl<<"Gross Salary=<<gs<<endl;
}
void
main(){
employee
e[N];
int i;
for(i=0;i<N;i++){
clrscr();
e[i].setemp();
getch();
}
for(i=0;i<N;i++){
clrscr();
e[i].getemp();
getch();
}
}
No comments:
Post a Comment