#include <iostream>
using namespace std;
class emp
{
    public:
    int a;
    char n[20];
    void getdata()
    {
        cout<<"Enter a Employee name:"
        cin>>n;
        cout<<"\nEnter a Employee ID";
        cin>>a;
    }
};
    class salary:public emp
    {
        int basic,HRA,DA,NP;
        public:
        void input()
        {
        cout<<"\nEnter a Basic Pay:";
        cin>>basic;
        cout<<"\nEnter a HRA:";
        cin>>HRA;
        cout<<"\n Enter a DA:"
        cin>>DA;
        }
        void netpay()
        {
            NP=basic+HRA+DA;
        }
        void display()
        {
            cout<<"\n"<<n<<"\t"<<a<<"\t"<<basic<<"\t"<<HRA<<"\t"<<DA;
        }
    };
    int main()
    {
        int b,i;
        salary s[20];
        cout<<"Enter a no.of employees:";
        cin>>b;
        for(i=0;i<b;i++)
        {
        s[i].getdata();
        s[i].input();
        s[i].netpay();
        }
        cout<<"\nEmployee Name\tEmployee ID\t Basic Pay\tHRA\t DA\tNetpay";
        for(i=0;i<b;i++)
        {
            s[i].display();
        }
        return 0;
    }
    
  


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: