#include<stdio.h>
#include<conio.h>
void main()
{
int i,n, j;
struct student
{
int id_no;
char name[40];
char address[40];
char combination[3];
int age;
}obj[100], temp;
printf("How many records to enter :" );
scanf("%d",&n);
printf("***** Enter students information : *****\n\n");
for(i=0; i<=n; i++)
{
printf("RECORD NO. %d",i+1);
printf("Enter student id_number : ");
scanf("%s",&obj[i].id_no);
printf("Enter name of the student: ");
scanf("%s",&obj[i].name);
printf("Enter address of the student : ");
scanf("%s",&obj[i].address);
printf("Enter combination of the student : ");
scanf("%s",&obj[i].combination);
printf("Enter age of the student : ");
scanf("%d",&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;
}
}
}
printf("***** The entered information in(id_no) sorted order is : *****\n\n");
for(i=1; i<=n; i++)
{
printf("RECORD NO. %d",i+1);
printf("Enter student id_number : ");
scanf("%d",&obj[i].id_no);
printf("Enter name of the student: ");
scanf("%s",&obj[i].name);
printf("Enter address of the student : ");
scanf("%s",&obj[i].address);
printf("Enter combination of the student : ");
scanf("%s",&obj[i].combination);
printf("Enter age of the student : ");
scanf("%d",&obj[i].age);
}
getch();
}