该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include #include
int main()
{int i,j,n1,n2,sum,temp;
printf("********************这是一个成绩统计和排序的程序********************\n\n\n");
printf("请输入学生的人数:\n");
scanf("%d",&n1);
printf("请输入课程数:\n");
scanf("%d",&n2);
int** ppiAvl=(int**)malloc(n1*sizeof(int*));
for(i=0;i
{ppiAvl[i]=(int*)malloc(n2*sizeof(int));
}
printf("---------------------------------------------------------\n");
for(i=0;i
{printf("第%d个学生\n",i+1);
for(j=0;j
{printf("第%d门课程:\n",j+1);
scanf("%d",&ppiAvl[i][j]);}
printf("------------------------------------------------------------\n");}
printf("学生\t");
for(j=0;j
{printf("第%d门课程\t",j+1);}
printf("总分");
printf("\n");
for(i=0;i
{printf("%d\t",i+1);
sum=0;
for(j=0;j
{printf("%d\t\t",ppiAvl[i][j]);
sum+=ppiAvl[i][j];
}printf("%d",sum);
printf("\n");}
for(j=0;j
{
printf("按第%d科排序:",j+1);
for(i=0;i
{
if(ppiAvl[i][j]
{ temp=ppiAvl[i+1][j];
ppiAvl[i+1][j]=ppiAvl[i][j];
ppiAvl[i][j]=temp;}
for(i=0;i
{
printf("%4d",ppiAvl[i][j]);
}
printf("\n");
}
}
for(j=0;j
{free(ppiAvl[j]);
}
free(ppiAvl);
system("pause");
return 0;
}