-
Notifications
You must be signed in to change notification settings - Fork 0
/
7.cpp
74 lines (56 loc) · 1.35 KB
/
7.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
63
64
65
66
67
68
69
70
71
72
73
74
/*
@Author: Amritanshu Sikdar
Session: 2018-'19
Repository: https://github.com/amritanshusikdar/CS30PracticalQuestion
*/
// Done as directed in Q7
#include <constream.h>
class student
{
private:
char name[20];
int rollNumber;
public:
void getData()
{
cout << "Enter Name: ";
cin.getline(name,20);
cout << "Enter Roll: ";
cin >> rollNumber;
}
void printData()
{
cout << "Name: " << name << endl;
cout << "Roll: " << rollNumber << endl;
}
};
class marks: public student
{
private:
int eng, phy, chem, math, cs;
public:
void inputData()
{
getData();
cout << "Enter marks of English, Physics, Chemistry, Math, CS: \n";
cin >> eng >> phy >> chem >> math >> cs;
}
void outData()
{
printData();
cout << "Marks as follows: \n";
cout << "English: " << eng << endl;
cout << "Physics: " << phy << endl;
cout << "Chemistry: " << chem << endl;
cout << "Math: " << math << endl;
cout << "CS: " << cs << endl;
}
};
void main()
{
clrscr();
marks ofStudent;
ofStudent.inputData();
ofStudent.outData();
getch();
}