Friday, 26 January 2018

WAP To find out the student details using multiple inheritance. C++ GTU

#include<iostream>
using namespace std;

class bio
{
    protected:
            int rollno;
            string name;
    public:
            void get()
            {
                cout<<"\nEnter Student name: ";
                cin>>name;
               
                cout<<"\nEnter Roll_No: ";
                cin>>rollno;
            }
           
};

class edu
{
    protected:
            float pr;
    public:
            void get1()
            {
                cout<<"\nEnter Percentage of Student: ";
                cin>>pr;
            }
};

class student:public bio,public edu
{
    public:
            void display()
            {
                cout<<"\nStudent name is:"<<name<<"\nRolll no is:"<<rollno<<"\nPercentage is:"<<pr<<"%";
            }
};

int main()
{
    student ob;
   
    ob.get();
    ob.get1();
    ob.display();
    return 0;
}

No comments:

Post a Comment

It's time To increase blogging capability. To have a chance to contribute in digital world. Any Interested People who want to make t...