This is a program i made..but i wanted it to arrnge the total in decreasing order showin the highest scorer 1st....what more should i do 4 that in this program....???
#include<iostream.h>
#include<conio.h>
void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];
int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50) :" ;
cin>>n;
for(int i=0;i<n;i++)
{
clrscr();
cout<<"\n\n\n\tEnter roll number\t";
cin>>rollno[i];
cout<<"\n\n\tEACH OUT OF 100\n\n\n";
cout<<"Enter English marks ";
cin>>english[i];
cout<<"Enter Science marks ";
cin>>science[i];
cout<<"Enter Social marks ";
cin>>social[i];
cout<<"Enter Hindi marks ";
cin>>hindi[i];
cout<<"Enter Maths marks ";
cin>>maths[i];
}
for(int i=0;i<n;i++)
{
clrscr();
Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];
if(Total[i]>450)
Grade[i]='A';
else if(Total[i]>400)
Grade[i]='A';
else if(Total [i]>300)
Grade[i]='A';
else if(Total[i]>200)
Grade[i]='A';
else Grade[i]='E';
}
for(int i=1;i<=(n-1);i++)
{ for(int j=(i+1);j<=n;j++)
{ if (Total[j]>Total[i])
{temp=Total[i];
Total[i]=Total[j];
Total[j]=temp;
}//if statement
} //inner for loop
}//outer for loop
cout<<"\n\n\n\t\tPROGRESS REPORT\n\n\n\n\t";
cout<<"\n\n\tRollno\t\tTotal\t\tGrade";
for(int i=0;i<n;i++)
{
cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i];
}
getch();
}