会C语言的高手进来帮忙啊,偶正在考试,不会考啊。。。

来源:百度知道 编辑:UC知道 时间:2024/05/13 07:59:19
题目:编写一个成绩统计处理程序,对学生成绩进行处理。每个学生包括学生姓名,性别,成绩三个信息。学生人数不定,但最多为10个。
用结构体实现,并用基于该结构体的数组来存储每个学生的信息。程序运行后,应能够键盘输入的每个学生的成绩,并分别统计出男学生和女学生的平均成绩,以及全体学生的及格率。最后输出统计结果

我来试一下 你这个要用到数据结构了
#include<stdio.h>
struct stud_node*Creat_Stu_Doc()
{
struct stud_node *head,*tail,*p;
int score;
char name[20];
char sex[3];

int size=sizeof(struct stud_node);

head=tail=NULL;
printf("input name,sex and score:\n");
scanf("%s%s%d",name,sex,&score);
while(number!=0){
p=(struct stud_node*)malloc(size);
strcpy(p->name,name);
strcpy(p->sex,sex);
p->score=score;
if(head==NULL)
head=p;
else
tail->next=p;
tail=p;
scanf("%s%s%d",name,sex,&score);
}
tail->next=NULL;
return head;
}
void main()
{
struct stud_node{
char