View Code of Problem 83

#include<stdio.h>
struct student{
int n;
int score;

};
int main()
{
int m,n,t,min,i,j;
scanf("%d %d",&m,&n);
struct student stu[1000],temp;
for(j=0;j<n+m;j++)
scanf("%d %d",&stu[j].n,&stu[j].score);
for(i=0;i<n+m;i++)
	{
	for(j=0;j<m+n-i-1;j++)
	{
		if(stu[j].n>stu[j+1].n)
		{
			temp=stu[j];stu[j]=stu[j+1];stu[j+1]=temp;
		}
		}
}
for( i=0;i<n+m;i++)
{printf("%d %d\n",stu[i].n,stu[i].score);}
return 0;


}

Double click to view unformatted code.


Back to problem 83