学生成绩管理系统 用C语言写

来源:百度知道 编辑:UC知道 时间:2024/05/26 08:02:45
要求用C语言写一个学生成绩管理系统,其中要包括2个结构体,一个是学生的姓名,年纪,班级,地址和电话,另外一个包括三门课程,课程名,分数等,要求能计算平均成绩

#include<stdio.h>
  #include<string.h>
  #include<malloc.h>
  #define LEN sizeof(struct stu)
  //#define NULL 0
  struct score
  {
  char work1[64];
  int score1;
  char work2[64];
  int score2;
  char work3[64];
  int score3;
  };
  struct stu
  {
  char name[100];
  int age;
  int classes;
  char address[500];
  char telephone[14];
  struct score results;
  struct stu *next;
  };
  struct stu *create(void)//创建链表
  {
  struct stu *p1,*p2,*head;
  int n=0;
  p1=p2=(struct stu *)malloc(LEN);
  head=NULL;
  printf("input the name: \nif name is empty,stop.\n");
  while(1)
  {
  gets(p1->name);
  if(p1->name[0]=='\0')
  {
  p2->next=NULL;
  free(p1);
  break;
  }
  else
  {
  printf("input : ");
  scanf("