AIM:-Consider problem statement given , implement initializing data member considering default basic salary 5000 rs.

Input:-

 

#include<iostream>

#include<string.h>

using namespace std;

class func

{

    char ch;

    int sub1,sub2,sub3,sub4,sub5,i;

    

public:

    

    func(int sub_1=10,int sub_2=10,int sub_3=10,int sub_4=10,int sub_5=10)

    {

        sub1=sub_1;

        sub2=sub_2;

        sub3=sub_3;

        sub4=sub_4;

        sub5=sub_5;

    }

    

    void accept()

    {

        cout<<“enter oop=:”;

        cin>>sub1;

        cout<<“enter rdbms=:”;

        cin>>sub2;

        cout<<“enter de=:”;

        cin>>sub3;

        cout<<“enter maths=:”;

        cin>>sub4;

        cout<<“enter ev=:”;

        cin>>sub5;

    }

    

    void display()

    {

        cout<<“\nenter oop=:”<<sub1;

        cout<<“\nenter rdbms=:”<<sub2;

        cout<<“\nenter de=:”<<sub3;

        cout<<“\nenter maths=:”<<sub4;

        cout<<“\nenter ev=:”<<sub5;

        cout<<“\n”;

    }

    

};

int main()

{

    

    func f(0,0);

    //f.accept();

    f.display();

    return 0;

}

Output:-

enter oop=:0

enter rdbms=:0

enter de=:10

enter maths=:10

enter ev=:10

Advertisements