-
Notifications
You must be signed in to change notification settings - Fork 0
/
Task11.h
111 lines (111 loc) · 1.98 KB
/
Task11.h
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
class student{
string Name;
int Rollno;
float Mid1;
float Mid2;
float Finalexam;
float *Quiz;
public:
student()
{
Name="";
Rollno=0;
Mid1=0;
Mid2=0;
Finalexam=0;
Quiz=new float[4];
Quiz[0]=0;
Quiz[1]=0;
Quiz[2]=0;
Quiz[3]=0;
}
student(string name,int rollno)
{
this->Name=name;
this->Rollno=rollno;
Mid1=0;
Mid2=0;
Finalexam=0;
Quiz=new float[4];
Quiz[0]=0;
Quiz[1]=0;
Quiz[2]=0;
Quiz[3]=0;
}
void print()
{
cout<<"Name : "<<Name<<endl;
cout<<"Roll No : "<<Rollno<<endl;
cout<<"Mid1 Marks : "<<Mid1<<endl;
cout<<"Mid2 Marks : "<<Mid2<<endl;
cout<<"Final Exam Marks : "<<Finalexam<<endl;
cout<<"Quiz1 Marks : "<<Quiz[0]<<endl;
cout<<"Quiz2 Marks : "<<Quiz[1]<<endl;
cout<<"Quiz3 Marks : "<<Quiz[2]<<endl;
cout<<"Quiz4 Marks : "<<Quiz[3]<<endl;
}
void setName(string name)
{
this->Name=name;
}
void setrollNo(int rollno)
{
this->Rollno=rollno;
}
void setMid1(float marks)
{
this->Mid1=marks;
}
void setMid2(float marks)
{
this->Mid2=marks;
}
void setFinal(float marks)
{
this->Finalexam=marks;
}
void setQuizMarks(float marks, int quiz_number)
{
this->Quiz[quiz_number-1]=marks;
}
float getTotalScore()
{
float total=Quiz[0]+Quiz[1]+Quiz[2]+Quiz[3]+Mid1+Mid2+Finalexam;
return total;
}
int compare(student &S)
{
if(S.getTotalScore()==getTotalScore())
{
return 0;
}
if(S.getTotalScore()>getTotalScore())
{
return 1;
}
if(S.getTotalScore()<getTotalScore())
{
return 2;
}
}
void copy(student &S)
{
this->Name=S.Name;
this->Rollno=S.Rollno;
this->Mid1=S.Mid1;
this->Mid2=S.Mid2;
this->Finalexam=S.Finalexam;
this->Quiz[0]=S.Quiz[0];
this->Quiz[1]=S.Quiz[1];
this->Quiz[2]=S.Quiz[2];
this->Quiz[3]=S.Quiz[3];
}
~student()
{
cout<<"Destructor invoked for <student name>";
}
};