Write a C program with a function defined to give the person
Solution
#include<iostream.h>
 #include<conio.h>
 #define SIZE 5 // we are defining the size of entries / variables to 5
 class emp
 {
    float basic,da,it,netsal; // salary , da and netsalary are mentioned in float
    char name[20],num[10];
    public:
        void getdata(); // function to get employee data
        void net_sal(); // function to get employee salary
void sal_hike(); // fuction to display hike based on net salary
        void dispdata(); // to dislay data
 
 };
 
 void emp::getdata() // enter basic employee details
    {
       cout<<\"\             Enter employee number: \" ;
       cin>>name;
       cout<<\"              Enter employee name: \" ;
       cin>>num;
       cout<<\"Enter employee basic salary in Rs: \" ;
       cin>>basic;
    }
 
 void emp::net_sal() // calculate net salary
    {
       da=((0.52)*basic );
       float gsal=da+basic;
       it=((0.3)*gsal);
       netsal=gsal-it;
    }
 void emp::sal_hike() // compute salary hike
int hike=net_sal + 0.2*net_sal;
}
 void emp::dispdata() // to display data
    {
       cout
            <<\"\       Employee number: \"<<name
            <<\"\         Employee name: \"<<num
            <<\"\    Employee netsalary: \"<<netsal<<\" Rs.\";
<<\"\  Employee hike is :\"<<sal_hike<<\"\"Rs.\";
 
    }
 
 void main()
 {
    clrscr();
    emp ob[SIZE]; // declare an onject for class emp
    int n;
    cout<<\"\ \ ***********************************\"
          <<\"\ Calculation of Employee Net Salary\"
          <<\"\ ***********************************\"
          <<\"\  Enter the number of employees\";
    cin>>n;
    for(int i=0;i<n;i++)
        {
            ob[i].getdata();
            ob[i].net_sal();
ob[i].sal_hike();
       }
      clrscr();
    cout<<\"\ -----------------\"
          <<\"\ Employee Detail::\"
          <<\"\ -----------------\";
    for( i=0;i<n;i++)
           {
            cout<<\"\ \  Employee:\"<<i+1
                <<\"\  ----------\";
            ob[i].dispdata();
           }
    getch();
 }


