# include <iostream>
# include <string>
using namespace std;
struct Info
{
long ID;
string stdname;
float GPA;
};
void bubblesort ( Info list[],int length);
void bubblesort ( Info list[],int length)
{
int index,step;
Info temp;
for (step=1; step<length; step++)
{
for ( index=0; index<length-step; index++)
if ( list[index].ID < list[index].ID )
{
temp = list[index];
list[index]=list[index+1];
list[index+1]=temp;
}
}
}
int main ()
{
Info st1[4] ;
cout << " Enter the ID"<<endl;
for( int i=0;i<4;i++)
cin >> st1[i].ID;
cout <<"Enter the name "<<endl;
for( int j=0;j<4;j++)
cin>>st1[j].stdname;
cout << " Enter the GPA"<<endl;
for ( int y=0 ; y<4 ; y++ )
cin>>st1[y].GPA;
bubblesort ( st1,4);
for ( int r=1 ; r<=4 ; r++ )
{
cout << " ID number " << " " << r <<" = " << st1[r].ID<<endl;
cout << " name number " << " " << r << " = " <<st1[r].stdname<<endl;
cout << " GPA number " << " " << r << " = " << st1[r].GPA<<endl;
}
system ( "pause");
return 0 ;
}