-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaxMarks.cpp
More file actions
59 lines (51 loc) · 1.04 KB
/
Copy pathMaxMarks.cpp
File metadata and controls
59 lines (51 loc) · 1.04 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
#include<iostream>
using namespace std;
class student
{
public:
char name[20];
int marks;
int rollno;
void input()
{
cin>>name>>rollno>>marks;
}
void display()
{
cout<<endl<<name<<endl;
}
float marksreturn()
{
return marks;
}
};
int main()
{
student S[10],temp;
int i,j,n;
cout<<"Enter the number of students whose data you want"<<endl;
cin>>n;
for (i = 0; i <= n-1; i++)
{
cout<<"Enter name,rollnumber,marks"<<endl;
S[i].input();
}
for(i=0;i<n;i++)
{
for(j=0;j<n-1;j++)
{
if(S[j].marks<S[j+1].marks)
{
student temp=S[j];
S[j]=S[j+1];
S[j+1]=temp;
}
}
}
cout<<"\nStudent Names in Descending Order of marks :- \n";
for(i=0;i<n;i++)
{
cout<<S[i].name<<endl;
}
return 0;
}