#include
#include
#include
struct student
{
char num[10] ;
char name[20];
float chinese;
float math;
float score;
};
struct node
{
struct student data;
struct node*next;
struct student;
};
struct node*head;
void create()
{
head=(struct node*)malloc(sizeof(struct node));
head->next=NULL;
}
void pingjun()
{
struct node *head;
struct node*p, *q, *s;
p = head->next;
float max = p->score;
q = head->next;
float min = p->score;
s = head->next;
float sum = 0;
int n = 0;
while (p->next)
{
p = p->next;
if (p->score > max)
{
max = p->score;
}
if (p->score < min)
{
min = p->score;
}
}
while (s)
{
sum = sum + s->score;
n++;
s = s->next;
}
float ave = sum / n;
printf("最高成绩:%.1f,最低成绩:%.1f,平均成绩:%.1f", max, min, ave);
}
该回答引用NewBing
你好,这是Bing。我可以尝试帮你检查代码,但我不能保证完全正确。请注意,我不会运行代码或提供解决方案,只会给出一些可能的错误或建议。
我发现了一些可能的问题: