Wednesday, January 5, 2011

c++ Program to read data of N employees and compute Net_salary of each employee.

#include iostream
#include iomanip
using namespace std;


class employee
{
private:int num;
char name[20];
float bs,gs,da,it,net;
public: employee()
{
num=0;
name[0]='\0';
bs=da=it=net=0;
};
void read();
void show();
void calc();
};



void employee :: read()
{
cout<
cin>>num;
cout<<"Enter employee name:";
cin>>name;
cout<<"Enter Basic salry:";
cin>>bs;
}


void employee :: calc()
{
da=0.52*bs;
gs=bs+da;
it=0.30*gs;
net=gs-it;
}


void employee :: show()
{
cout<
}


int main()
{
employee e[20];
int i, n;


cout<
cin>>n;


for(i=0;i
e[i].read();
cout<
cout<
for(i=0;i
{
e[i].calc();
e[i].show();
}


return 0;
}






No comments:

Post a Comment