c语言问题 急急 !!
void main() {
printf("********************************************************\n");
printf("******************运动员成绩录入************************\n");
printf("********************************************************\n");
//******************************输入**********************
int i=0,j=0;
float temp=0;
struct athlet athlet1[N];
for(i=0;i<N;i++)
{
printf("姓名: ");
gets(athlet1[i].name);
printf("编号: ");
scanf("%d",&athlet1[i].number);
printf("分数一,分数二,分数三: ");
scanf("%f,%f,%f",&athlet1[i].score[0],&athlet1[i].score[1],&athlet1[i].score[2]);
}
for(i=0;i<N;i++)
{
athlet1[i].total=0;
for(j=0;j<3;j++)
{
athlet1[i].total+=athlet1[i].score[j];
}
}
//************************排序****************************
for(i=0;i<N-1;i++)
{
for(j=0;j<N-1-i;j++)
{
if(athlet1[j].total>athlet1[j+1].total)
{
temp=athlet1[j].total;
athlet1[j].total=athlet1[j+1].total;
athlet1[j+1].total=temp;
}
}
}
//***************************输出*********************************
for(i=0;i<N;i++)
{
printf("编号: %d ",athlet1[i].number);
printf("姓名: %s ",athlet1[i].name);
for(j=0;j<3;j++)
{
printf("分数[%d]: %4.2f ",j,athlet1[i].score[j]);
}
printf("总成绩: %4.2f ",athlet1[i].total);
printf("平均数: %4.2f ",athlet1[i].total/3);
printf("\n\n");
}
}
为什么第二次循环时 编号和姓名一起出啊?