追问
Number: Name: score: Average: rank:
这一行没有,怎么办?要求和下方对应,一条对一条
温馨提示:内容为网友见解,仅供参考
第1个回答 2020-05-28
#include <stdio.h>
int main()
{struct student
{long int a;
char b[10];
float c;
float d;
float e;
int f;
float g;
}man[5];
int i,j,k,l;
for(i=0;i<5;i++)
{scanf("%ld %s %f %f %f",&man[i].a,&man[i].b,&man[i].c,&man[i].d,&man[i].e);
man[i].g=(man[i].c+man[i].d+man[i].e)/3;
}
for(i=0;i<5;i++)
{man[i].f=5;
for(j=0;j<5;j++)
{ if(man[i].g>man[j].g)
man[i].f=man[i].f-1;
}
}
printf("Number: Name: score: Average: rank:\n");
for(i=0;i<5;i++)
printf("%-9ld%-10s%-5.1f%-5.1f%-8.1f%-10.1f%-d\n",man[i].a,man[i].b,man[i].c,man[i].d,man[i].e,man[i].g,man[i].f);
return 0;
}
int main()
{struct student
{long int a;
char b[10];
float c;
float d;
float e;
int f;
float g;
}man[5];
int i,j,k,l;
for(i=0;i<5;i++)
{scanf("%ld %s %f %f %f",&man[i].a,&man[i].b,&man[i].c,&man[i].d,&man[i].e);
man[i].g=(man[i].c+man[i].d+man[i].e)/3;
}
for(i=0;i<5;i++)
{man[i].f=5;
for(j=0;j<5;j++)
{ if(man[i].g>man[j].g)
man[i].f=man[i].f-1;
}
}
printf("Number: Name: score: Average: rank:\n");
for(i=0;i<5;i++)
printf("%-9ld%-10s%-5.1f%-5.1f%-8.1f%-10.1f%-d\n",man[i].a,man[i].b,man[i].c,man[i].d,man[i].e,man[i].g,man[i].f);
return 0;
}
第2个回答 2019-06-05
#include<stdio.h>
struct student
{
long num;
char name[10];
float score[3];
float ave;
int rank;
};
int main()
{
struct student stu[5];
int i,j,t;
for(i=0;i<5;i++)
{
scanf("%ld %s %f %f %f",&stu[i].num,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
stu[i].ave=(stu[i].score[0]+stu[i].score[1]+stu[i].score[2])/3;
stu[i].rank=5;
}
for(t=0;t<5;t++)
{
for(i=0;i<5;i++)
{
if(stu[t].ave>stu[i].ave)
stu[t].rank--;
}
}
printf("Number: Name: score: Average: rank:\n");
for(i=0;i<5;i++)
printf("%-9ld%-10s%-5.1f%-5.1f%-8.1f%-10.1f%-d\n",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].ave,stu[i].rank);
return 0;
}
struct student
{
long num;
char name[10];
float score[3];
float ave;
int rank;
};
int main()
{
struct student stu[5];
int i,j,t;
for(i=0;i<5;i++)
{
scanf("%ld %s %f %f %f",&stu[i].num,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
stu[i].ave=(stu[i].score[0]+stu[i].score[1]+stu[i].score[2])/3;
stu[i].rank=5;
}
for(t=0;t<5;t++)
{
for(i=0;i<5;i++)
{
if(stu[t].ave>stu[i].ave)
stu[t].rank--;
}
}
printf("Number: Name: score: Average: rank:\n");
for(i=0;i<5;i++)
printf("%-9ld%-10s%-5.1f%-5.1f%-8.1f%-10.1f%-d\n",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].ave,stu[i].rank);
return 0;
}
第3个回答 2018-11-14
调试没成功,错哪呢
相似回答