Tuesday, 3 September 2013

Bio Data Multiple Inheritance

#include<iostream.h>
#include<conio.h>
class mahi
{
    protected:
        char name[20],gender[20];
        int age;
    public:
    void putdata()
    {
    cout<<"\n Enter The Name: ";
    cin>>name;
    cout<<"\n Enter The Age: ";
    cin>>age;
    cout<<"\n Enter The Gender: ";
    cin>>gender;
    }
};
class aditi:public mahi
{
    protected:
        char std[50];
    public:
    void putdata1()
    {
    cout<<"\n Enter The Standard: ";
    cin>>std;
    }
};
class priyanka:public aditi
{
    protected:
        char mo[50],email[50];
    public:
    void putdata2()
    {
    cout<<"\n Enter The Mobile Number: ";
    cin>>mo;
    cout<<"\n Enter The Email Address: ";
    cin>>email;
    }
};
class apeksha:public priyanka
{
    protected:
        char add[50],city[50],state[50];
    public:
    void putdata3()
    {
    cout<<"\n Enter The Address: ";
    cin>>add;
    cout<<"\n Enter The City: ";
    cin>>city;
    cout<<"\n Enter The State: ";
    cin>>state;
    }
};
class madam:public apeksha
{
    public:
        void show()
        {
            cout<<"\n Name: "<<name;
            cout<<"\n Age: "<<age;
            cout<<"\n Gender: "<<gender;
            cout<<"\n Standard: "<<std;
            cout<<"\n Email: "<<email;
            cout<<"\n Mobile no: "<<mo;
            cout<<"\n Address: "<<add;
            cout<<"\n City: "<<city;
            cout<<"\n State: "<<state;
        }
};
void main()
{
    clrscr();
    madam m1;
    m1.putdata();
    m1.putdata1();
    m1.putdata2();
    m1.putdata3();
    m1.show();
    getch();
}

No comments:

Post a Comment