-
Notifications
You must be signed in to change notification settings - Fork 0
/
multileevel.cpp
58 lines (55 loc) · 947 Bytes
/
multileevel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<iostream>
using namespace std;
class student
{
protected:
int roll_no;
public:
void setroll_no(int);
void getroll_no();
};
void student::setroll_no(int b)
{
roll_no=b;
}
void student::getroll_no()
{
cout<<"roll no is : "<<roll_no<<endl;
}
class marks:public student
{
protected:
float maths;
float physics;
public:
void set_marks(float,float);
void get_marks();
};
void marks::set_marks(float a,float b)
{
maths=a;
physics=b;
}
void marks::get_marks()
{
cout<<"marks in maths is "<<maths<<endl;
cout<<"marks in physics is "<<physics<<endl;
}
class result:public marks
{
public:
void res()
{
getroll_no();
get_marks();
cout<<"percentage is "<<(physics+maths)/2<<"%"<<endl;
}
};
int main()
{
result ronak;
ronak.setroll_no(5614);
ronak.set_marks(98,76);
ronak.res();
return 0;
}