View Code of Problem 83

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

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

for(int 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