SDT OJ 1334

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct stud
{
char name[15][10];
int mark[10];
}student;
int main()
{
int i,j,l;
for(i=0;i<=9;i++)
gets(student.name[i]);
for(i=0;i<10;i++)
scanf("%d",&student.mark[i]);
for (i=0;i<=8;i++)
{
for (j=0;j<=8-i;j++)
{
if (strcmp(student.name[j],student.name[j+1])>0)
{
strcpy(student.name[11],student.name[j]);
strcpy(student.name[j],student.name[j+1]);
strcpy(student.name[j+1],student.name[11]);
l=student.mark[j];
student.mark[j]=student.mark[j+1];
student.mark[j+1]=l;
}
}
}
for(i=0;i<=9;i++)
printf("%s,%d ",student.name[i],student.mark[i]);
return 0;
}

请dalao不吝赐教。
原文地址:https://www.cnblogs.com/liesun/p/3157470.html