-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentDetails.c
More file actions
380 lines (366 loc) · 9.42 KB
/
StudentDetails.c
File metadata and controls
380 lines (366 loc) · 9.42 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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
#include<stdio.h>
#include<string.h>
struct student
{
int rollno;
float eng,mat,phy,chem,proginc,civmech,total,avg;
char name[20];
};
int main()
{
int i,n,n1,j,choice;
struct student st[65];
printf("ENTER THE NUMBER OF STUDENTS:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter the records of student %d",i+1);
printf("\nEnter the roll number:");
scanf("%d",&st[i].rollno);
printf("\nEnter the name:");
scanf("%s",st[i].name);
printf("\nEnter the marks in English,maths,physics,chemistry,proginc,civmech:");
scanf("%f%f%f%f%f%f",&st[i].eng,&st[i].mat,&st[i].phy,&st[i].chem,&st[i].proginc,&st[i].civmech);
st[i].total=st[i].eng+st[i].mat+st[i].phy+st[i].chem+st[i].proginc+st[i].civmech;
st[i].avg=st[i].total/6;
}
do
{
printf("\n .....YOUR MENU .....\n1.Display details\n2.Toppers\n3.Slow learners\n4.English toppers\n5.Maths toppers\n6.Physics toppers\n7.Chemistry toppers\n8. Prog in C toppers\n9.Civil&Mech toppers\n10.Exit" );
printf("\nENTER YOUR CHOICE:");
scanf("%d",&choice);
switch(choice)
{
case 1:
{
int r;
printf("\nEnter the roll number:");
scanf("%d",&r);
for(i=0;i<n;i++)
{
if(r==st[i].rollno)
{
printf("\nTHE DETAILS ARE.....");
printf("\n Roll no:%d",st[i].rollno);
printf("\n Name:%s",st[i].name);
printf("\n ...MARKS...\n English:%f\nMaths:%f\nPhysics:%f\nChemistry:%f\nProg in C:%f\nCivil&Mech:%f\nTotal:%f\nAverage:%f",st[i].eng,st[i].mat,st[i].phy,st[i].chem,st[i].proginc,st[i].civmech,st[i].total,st[i].avg);
}
}
break;
}
case 2:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].total<st[j].total)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\nTOP %d TOPPERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nTotal:%f\nAverage:%f",i+1,st[i].rollno,st[i].name,st[i].total,st[i].avg);
}
break;
}
case 3:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].total>st[j].total)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\n %d SLOW LEARNERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nTotal:%f\nAverage:%f",i+1,st[i].rollno,st[i].name,st[i].total,st[i].avg);
}
break;
}
case 4:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].eng<st[j].eng)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\n %d ENGLISH TOPPERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nEnglish:%f",i+1,st[i].rollno,st[i].name,st[i].eng);
}
break;
}
case 5:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].mat<st[j].mat)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\n %d MATHS TOPPERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nMaths:%f",i+1,st[i].rollno,st[i].name,st[i].mat);
}
break;
}
case 6:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].phy<st[j].phy)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\n %d PHYSICS TOPPERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nPhysics:%f",i+1,st[i].rollno,st[i].name,st[i].phy);
}
break;
}
case 7:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].chem<st[j].chem)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\n %d CHEMISTRY TOPPERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nChemistry:%f",i+1,st[i].rollno,st[i].name,st[i].chem);
}
break;
}
case 8:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].proginc<st[j].proginc)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\n %d PROGINC TOPPERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nProg in C:%f",i+1,st[i].rollno,st[i].name,st[i].proginc);
}
break;
}
case 9:
{
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(st[i].civmech<st[j].civmech)
{
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
}
}
printf("\nENTER THE NO OF STUDENTS TO BE DISPLAY:");
scanf("%d",&n1);
printf("\n %d CIVIL&MECH TOPPERS",n1);
for(i=0;i<n1;i++)
{
printf("\n%d.\n Roll no:%d\n Name:%s\nCivil&Mech:%f",i+1,st[i].rollno,st[i].name,st[i].civmech);
}
break;
}
case 10:
break;
default:
printf("INVALID CHOICE");
}
}while(choice!=10);
return 0;
}
/*OUTPUT
ENTER THE NUMBER OF STUDENTS:2
Enter the records of student 1
Enter the roll number:65
Enter the name:aarthy
Enter the marks in English,maths,physics,chemistry,proginc,civmech:90
90
90
90
90
90
Enter the records of student 2
Enter the roll number:66
Enter the name:abi
Enter the marks in English,maths,physics,chemistry,proginc,civmech:90
80
80
80
80
80
.....YOUR MENU .....
1.Display details
2.Toppers
3.Slow learners
4.English toppers
5.Maths toppers
6.Physics toppers
7.Chemistry toppers
8. Prog in C toppers
9.Civil&Mech toppers
10.Exit
ENTER YOUR CHOICE:80
INVALID CHOICE
.....YOUR MENU .....
1.Display details
2.Toppers
3.Slow learners
4.English toppers
5.Maths toppers
6.Physics toppers
7.Chemistry toppers
8. Prog in C toppers
9.Civil&Mech toppers
10.Exit
ENTER YOUR CHOICE:1
Enter the roll number:65
THE DETAILS ARE.....
Roll no:65
Name:aarthy
...MARKS...
English:90.000000
Maths:90.000000
Physics:90.000000
Chemistry:90.000000
Prog in C:90.000000
Civil&Mech:90.000000
Total:540.000000
Average:90.000000
.....YOUR MENU .....
1.Display details
2.Toppers
3.Slow learners
4.English toppers
5.Maths toppers
6.Physics toppers
7.Chemistry toppers
8. Prog in C toppers
9.Civil&Mech toppers
10.Exit
ENTER YOUR CHOICE:2
ENTER THE NO OF STUDENTS TO BE DISPLAY:2
TOP 2 TOPPERS
1.
Roll no:65
Name:aarthy
Total:540.000000
Average:90.000000
2.
Roll no:66
Name:abi
Total:490.000000
Average:81.666664
.....YOUR MENU .....
1.Display details
2.Toppers
3.Slow learners
4.English toppers
5.Maths toppers
6.Physics toppers
7.Chemistry toppers
8. Prog in C toppers
9.Civil&Mech toppers
10.Exit
ENTER YOUR CHOICE:8
ENTER THE NO OF STUDENTS TO BE DISPLAY:2
2 PROGINC TOPPERS
1.
Roll no:65
Name:aarthy
Prog in C:90.000000
2.
Roll no:66
Name:abi
Prog in C:80.000000
.....YOUR MENU .....
1.Display details
2.Toppers
3.Slow learners
4.English toppers
5.Maths toppers
6.Physics toppers
7.Chemistry toppers
8. Prog in C toppers
9.Civil&Mech toppers
10.Exit
ENTER YOUR CHOICE:10 */