这个是第1次的作业`~~~~~~.应该会有用的
#include<stdio.h>
#define N 8
void main()
{
int s[N],score[N][4];
double average[N],t;
char title[][10]={"学号","姓名","数学","物理","英语","计算机","平均成绩"};
char xuehao[N][10],name[N][8];
int k=0,a,b;
for(;k<N;k++)
{
printf("\ninput xuehao %d:",k+1);
scanf("%s",xuehao[k]);
printf("\ninput name %d:",k+1);
scanf("%s",name[k]);
printf("\ninput score[%d][0] score[%d][1] scre[%d][2] score[%d][3]:",k,k,k,k);
scanf("%d%d%d%d",&score[k][0],&score[k][1],&score[k][2],&score[k][3]);
}
printf("\n%-10s%-10s%-6s%-6s%-6s%-8s",
title[0],title[1],title[2],title[3],title[4],title[5],title[6]);
printf("\n-------------------------------------------------------------------");
for(k=0;k<N;k++)
printf("\n%-10s%-8s%4d %4d %4d %6d ",xuehao[k],name[k],score[k][0],score[k][1],score[k][2],score[k][3]);
for(k=0;k<N;k++)
average[k]=(score[k][0]+score[k][1]+score[k][2]+score[k][3])/4.0;
printf("\n%-10s%-10s%-6s%-6s%-6s%-8s",title[0],title[1],title[2],title[3],title[4],title[5],title[6]);
printf("\n-------------------------------------------------------------------");
for(k=0;k<N;k++)
printf("\n%-10s%-8s%4d %4d %4d %6d %7.1f ",xuehao[k],name[k],score[k][0],score[k][1],score[k][2],score[k][3],average[k]);
for(k=0;k<N;k++)
s[k]=k;
for(a=1;a<N;a++)
for(b=0;b<N-a;b++)
if(average[b]>average[b+1])
{
t=average[b];
average[b]=average[b+1];
average[b+1]=t;
k=s[b];s[b]=s[b+1];s[b+1]=k;
}
printf("\n%-10s%-10s%-6s%-6s%-6s%-8s%-8s",title[0],title[1],title[2],title[3],title[4],title[5],title[6]);
printf("\n-------------------------------------------------------------------");
for(k=0;k<N;k++)
printf("\n%-10s%-8s%4d %4d %4d %6d %7.1f",xuehao[s[k]],name[s[k]],score[s[k]][0],score[s[k]][1],score[s[k]][2],score[s[k]][3],average[k]);
}