-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem3.cpp
More file actions
90 lines (72 loc) · 1.47 KB
/
problem3.cpp
File metadata and controls
90 lines (72 loc) · 1.47 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <iostream>
using namespace std;
class student
{
private:
char nameofstud[100],grade;
int rollno;
float it1,it2,it3,avrg;
public:
void input();
void output();
void process();
};
void student::input()
{
cout << "Enter NAME of the student: " ;
cin >> nameofstud;
cout << "Enter Roll number of the student: ";
cin >> rollno;
cout<<"enter Marks between 1 to 25\n";
cout << "Enter Marks of IT 1,2 and 3 respectively"<<endl;
cin >> it1>>it2>>it3;
process();
}
void student::output()
{
cout<<avrg<<endl<<grade<<endl;
}
void student::process()
{
if(((it2>it1)&&(it2>it3)&&(it3>it1))||((it3>it1)&&(it3>it2)&&(it2>it1)))
avrg=(it2+it3)/2.0;
else if(((it1>it2)&&(it1>it3)&&(it2>it3))||((it2>it1)&&(it2>it3)&&(it1>it3)))
avrg=(it1+it2)/2.0;
else
avrg=(it1+it3)/2.0;
cout<<"\ngrade of sudent\n:";
if(avrg>=22 && avrg<=25)
cout<<"A";
else if(avrg>=18 && avrg<21)
cout<<"B";
else if(avrg>=14 && avrg<18)
cout<<"C";
else if(avrg>=10 && avrg<14)
cout<<"D";
else if(avrg>=6 && avrg<10)
cout<<"E";
else if(avrg>=1&& avrg<6)
cout<<"F";
else
cout<<"invaliud";
}
int main()
{
student stud1[100];
int n,i;
float avrg;
cout << "Enter total number of students: ";
cin >> n;
for(i=0;i<=n-1; i++)
{
cout << "\nEnter details of student " << i+1 <<endl;
stud1[i].input();
}
cout << endl;
for(i=0;i<=n-1; i++)
{
cout <<"\n\n average of student " << (i+1) <<endl;
stud1[i].output();
}
return 0;
}