-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport_card.cpp
63 lines (56 loc) · 1.23 KB
/
report_card.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>
#include<string.h>
using namespace std;
class ReportCard
{
int marks[10],total;
int t_max;
float per;
char grade[10];
public: void input();
void cal_percentage();
void find_grade();
};
int main()
{
ReportCard rc;
cout<<endl<<"input the details ";
rc.input();
rc.cal_percentage();
rc.find_grade();
}
void ReportCard::input()
{
cout<<endl<<"Enter the marks in 5 theory & practical subjects of a student:"<<endl;
for(int i=0;i<10;i++)
cin>>marks[i];
cout<<endl<<"Enter the maximum marks: ";
cin>>t_max;
cout<<endl<<"Max="<<t_max;
}
void ReportCard::cal_percentage()
{
total=0;
for(int i=0;i<5;i++)
{
total=total+marks[i];
}
cout<<endl<<"Total marks of a student="<<total;
per=(total*100.0f)/t_max;
cout<<endl<<"Percentage of a student="<<per;
cout<<endl<<"Max="<<t_max;
}
void ReportCard::find_grade()
{
if(per<33)
strcpy(grade,"Fail");
else if(per>33 && per<48)
strcpy(grade,"III Div");
else if(per>48 && per<59)
strcpy(grade,"II Div");
else if(per>59 && per<60)
strcpy(grade,"I Div");
else if(per>75)
strcpy(grade,"Distition");
cout<<endl<<"Grade = "<<grade;
}