#include<iostream>
#include<conio.h>
using namespace std;
struct student
{
char name[10];
int cls;
char sec;
}a[20];
void accept(student s[],int n)
{
for(int i=0;i<n;i++)
{
cout<<"ENTER DETAILS OF STUDENT "<<i+1<<":";
cout<<"NAME:";
cin>>s[i].name;
cout<<"CLASS:";
cin>>s[i].cls;
cout<<"SECTION:";
cin>>s[i].sec;
}
}
void bubblesort(student a[],int n)
{
int i,j,flg;
student temp;
for(i=0;i<5;i++)
{
flg=0;
for(j=0;j<n-i-1;j++)
{
if(a[j].cls>a[j+1].cls)
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
flg=1;
}
else if((a[j].cls==a[j+1].cls)&&(a[j].sec>a[j+1].sec))
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
flg=1;
}
}
if(flg==0)
break;
}
cout<<"NAME\tCLASS\tSECTION\n";
for(i=0;i<n;i++)
cout<<a[i].name<<"\t"<<a[i].cls<<"\t"<<a[i].sec<<endl;
}
int main()
{
cout<<endl<<endl;
cout<<"*****************************************************************************";
cout<<endl<<endl;
cout<<"ENTER NUMBER OF RECORDS YOU WANT TO ENTER(max 20):";
int n;
cin>>n;
accept(a,n);
bubblesort(a,n);
cout<<"*****************************************************************************";
getch();
return 0;

}

USERS VISITED
http://www.hitwebcounter.com/