-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha5_10672622.cpp
189 lines (105 loc) · 3.54 KB
/
a5_10672622.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
struct studentType //-------------- #It's not by might kraa. Struct helped alongside array to give the program some form.
{
int IDNo[5];
string Name[5];
int Age[5];
int Gender[5];
double Score[5];
string Grade[5];
} ;
int main()
{
int sh;
int MaleCount;
int FemaleCount;
studentType sark; // -------- Since He gave sh some Advice :)
double m;
for (sh = 1; sh < 6; sh = sh+1)
{
cout << "Enter ID" <<endl;
cin >> sark.IDNo[sh];
cout << "enter Name" <<endl;
cin >> sark.Name[sh];
cout << "Enter Age" <<endl;
cin >> sark.Age[sh];
cout << "Enter Gender (M =1 or F = 2)"<<endl;
cin >> sark.Gender[sh];
cout << "Enter Score" <<endl;
cin >> sark.Score[sh];
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
double m = sark.Score[sh];
string q = sark.Grade[sh];
if(m <= 39){
q = "F";
}
else if (m <=49 && m >=40)
{
q = "E";
}
else if (m <=59 && m >=50)
{
q = "D";
}
else if (m <=69 && m >=60)
{
q = "C";
}
else if (m <=79 && m >=70)
{
q = "B";
}
else if (m >=80 && m <= 100)
{
q = "A";
}
}
cout << endl;
if (sark.Gender[sh] == 1 )
{
MaleCount = MaleCount + 1;
}
else if (sark.Gender[sh] != 1 )
{
FemaleCount = FemaleCount + 1;
}
cout << " Id " << " " << " Name " << " " << " Age " << " " << " Gender " << " " << " Score " << " " << " Grade " <<endl;
cout << "************************************************************************************" <<endl;
string q = sark.Grade[sh];
double averageScore;
double averageAge;
for ( sh =1; sh < 6; sh = sh++)
{
double averageScore = (averageScore + sark.Score[sh])/5;
double averageAge = (averageAge+ sark.Age[sh])/5;
cout << sark.IDNo[sh] << " " << sark.Name[sh] << " " << sark.Age[sh] << " " << sark.Gender[sh] << " " << sark.Score[sh] << " " << q;
cout <<endl;
}
cout << "**********************************************************************************************************" <<endl;
cout << "AVERAGE SCORE:" << averageScore <<endl;
cout << "AVERAGE AGE:" << averageAge << endl;
cout << "MALE COUNT:" << MaleCount <<endl;
cout << "FEMALE COUNT:" << FemaleCount <<endl;
ofstream a5_10672622;
a5_10672622.open("Codes And Jams.txt", ios::app);
a5_10672622 << " Id " << " " << " Name " << " " << " Age " << " " << " Gender " << " " << " Score " << " " << " Grade " <<endl;
a5_10672622 << "************************************************************************************" <<endl;
for ( sh =1; sh < 6; sh = sh++)
{
double averageScore = (averageScore + sark.Score[sh])/5;
double averageAge = (averageAge+ sark.Age[sh])/5;
a5_10672622 << sark.IDNo << " " << sark.Name << " " << sark.Age << " " << sark.Gender << " " << sark.Score << " " << q;
a5_10672622 <<endl;
}
a5_10672622 << "**********************************************************************************************************" <<endl;
a5_10672622 << "AVERAGE SCORE:" << averageScore <<endl;
a5_10672622 << "AVERAGE AGE:" << averageAge << endl;
a5_10672622 << "MALE COUNT:" << MaleCount <<endl;
a5_10672622 << "FEMALE COUNT:" << FemaleCount <<endl;
a5_10672622.close();
return 0;
}