#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int i, n, j;
struct student
{
int id_no;
char name[40];
char address[40];
char combination[3];
int age;
}obj[100], temp;
cout<<"How many records to enter :";cin>>n;
cout<<"***** Enter students information : *****"<<endl<<endl;
for(i=1; i<=n; i++)
{
cout<<"RECORD NO."<<i<<endl;
cout<<"Enter student id_number : ";
cin>>obj[i].id_no;
cout<<"Enter name of the student: ";
cin>>obj[i].name;
cout<<"Enter address of the student : ";
cin>>obj[i].address;
cout<<"Enter combination of the student : ";
cin>>obj[i].combination;
cout<<"Enter age of the student : ";
cin>>obj[i].age;
}
for(i=1; i<=n-1; i++)
{
for(j=i+1; j<=n; j++)
{
if(obj[i].id_no>obj[i].id_no)
{
temp=obj[i];
obj[i]=obj[j];
obj[j] = temp;
}
}
}
cout<<endl<<"***** The entered information in(id_no) sorted order is : *****"<<endl<<endl;
for(i=1; i<=n; i++)
{
cout<<"RECORD NO."<<i<<endl;
cout<<"Enter student id_number : "<<obj[i].id_no<<endl;
cout<<"Enter name of the student: "<<obj[i].name<<endl;
cout<<"Enter address of the student : "<<obj[i].address<<endl;
cout<<"Enter combination of the student : "<<obj[i].combination<<endl;
cout<<"Enter age of the student : "<<obj[i].age<<endl;
}
getch();
return 0;
}