#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;
}
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