-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut45.cpp
More file actions
73 lines (67 loc) · 1.23 KB
/
tut45.cpp
File metadata and controls
73 lines (67 loc) · 1.23 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
using namespace std;
class Student
{
protected:
int roll;
public:
void setroll(int a)
{
roll = a;
}
void getroll()
{
cout << "Your roll number is " << roll << endl;
}
};
class Test : virtual public Student
{
protected:
float maths, physics;
public:
void setnum(float m1, float p1)
{
maths = m1;
physics = p1;
}
void printmar()
{
cout << "Your marks is: " << endl
<< "Maths: " << maths << endl
<< "Physics: " << physics << endl;
}
};
class Sports : public virtual Student
{
protected:
float score;
public:
void setscore(float s){
score = s;
}
void getscore(){
cout<<"Your score is: "<<score<<endl;
}
};
class result : public Test , public Sports
{
private:
float total;
public:
void show(void){
total = maths + physics+ score;
getroll();
printmar();
getscore();
cout<<"Your total score is: "<<total<<endl;
}
};
int main()
{
result yash;
yash.setroll(076);
yash.setscore(5000);
yash.setnum(89.9,88.9);
yash.show();
return 0;
}