forked from usamajay/hacktoberfest2021-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentResult.cpp
62 lines (46 loc) · 858 Bytes
/
StudentResult.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
59
60
61
62
#include<iostream>
using namespace std;
class Student
{
protected :
float id,m1,m2,m3;
char name[50];
public :
void getData()
{
cout<<"Enter Student Id : ";
cin>>id;
cout<<"Enter Student Name : ";
cin.ignore();
cin.getline(name,50);
//cin>>name;
cout<<"Enter Maths Mark : ";
cin>>m1;
cout<<"Enter Physics Mark : ";
cin>>m2;
cout<<"Enter Chemistry Mark : ";
cin>>m3;
}
};
class print : public Student
{
float t;
public :
void setData()
{
cout<<endl<<"Id : "<<id<<endl;
cout<<"Name : "<<name<<endl;
cout<<"Maths : "<<m1<<endl;
cout<<"Physics : "<<m2<<endl;
cout<<"Chemistry : "<<m3<<endl;
t = (m1 + m2+ m3) / 3;
cout<<"Total : "<<m1+m2+m3<<endl;
cout<<"Result : "<<t;
}
};
main()
{
print p;
p.getData();
p.setData();
}