有十个学生。每个学生包括学号,姓名,和三门成绩。从键盘输入十个学生的成绩,

来源:百度知道 编辑:UC知道 时间:2024/09/28 15:14:22
有十个学生。每个学生包括学号,姓名,和三门成绩
从键盘输入十个学生的成绩,要求三门总成绩的平均分,,和最高分的学生数据(学号,姓名,三门成绩)

新手。。希望高手能按我的思路改一次啊。。非常感谢。。我就那么点分了。。以后一定追加分

#include<stdio.h>
#include<malloc.h>
#define NULL 0
#define LEN sizeof(stuct student)
struct student
{ int num;
int score[3];
struct student *next;
};
int n;
int sum;
int max;
struct student *creat()
{
n=0;sum=0;max=0;
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(LEN);
scanf("%d,%s,%d,%d,%d\n",&p1->num,p1->name,&p1->score[1],&p1->score[2],&p1->score[3]);
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
if(n<10)
{p1=(struct student*)malloc(LEN);
scanf("%d,%s,%d,%d,%d\n",&p1->num,p1->name,&p1->score[1],&p1->score[2],&p1->score[3]);
}
}
p2->next=NULL;
return(head) ;

主要是不懂,要不就帮你做了!

你这也太长了 说说哪出错了

#include<stdio.h>
#include<malloc.h>
#define NULL 0
#define LEN sizeof(stuct student)
struct student
{ int num;
int score[3];
struct student *next;
};
int n;
int sum;
int max;
struct student *creat()
{
n=0;sum=0;max=0;
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(LEN);
scanf("%d,%s,%d,%d,%d\n",&p1->num,p1->name,&p1->score[1],&p1->score[2],&p1->score[3]);
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
if(n<10)
{p1=(struct student*)malloc(LEN);
scanf("%d,%s,%d,%d,%d\n",&p1->num,p1->name,&p1->score[1],&p1->score[2],&p1->score[3]);
}
}
p2->next=NULL;
return(head) ;
}
void main()
{
struct student *p;
p=*cr

有四个学生,每个学生包括学号、姓名、成绩。要求找出成绩最高者的姓名和成绩。 编制一个学生籍贯信息记录簿,每个学生信息包括:学号、姓名、籍贯、性别。具体功能: 帮忙用C语言编程:有10个学生,每个学生数据包括学号,姓名,四门课的成绩,从键盘输入10个学生的数据记录 某实验班有10名学生,每个学生的数据包括学号、姓名及3门课程的成绩。编写程序完成下列任务: 课程设计 学校有N个学生,每个学生的数据包括学号、姓名、性别、年龄和专业,用C 语言编写一 求一个学生成绩管理系统程序~有N个学生~每个学生数据包含学号,姓名,三门课的成绩及平均成绩。急 c语言 学生信息包括,学号,姓名,五门功课的成绩.输入输出。总分排序 急求C++程序~~定义一个学生记录类型(包括学号,姓名,平均分) 从键盘输入五个学生数据.包括 学号 姓名 成绩 存入文件 显示出来 10个学生,每个3门成绩,用函数求出最高分的那个学生的学号、3门成绩