C语言设计!!! 急急急!!!

来源:百度知道 编辑:UC知道 时间:2024/05/25 11:12:30
学生选修课程系统设计
假定有n门课程,每门课程有课程编号,课程名称,课程性质,总学时,授课学时,实验或上机学时,学分,开课学期等信息,学生可按要求(如总学分不得少于60)自由选课。试设计一选修课程系统,使之能提供以下功能:
课程信息录入功能(课程信息用文件保存)
课程信息浏览功能
查询功能:(至少一种查询方式)
按学分查询
按课程性质查询
学生选修课程

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
typedef struct subjects
{
int num;
char name[20];
char kind[10];
int stime;
int ttime;
int etime;
int score;
int term;
struct subjects *next;
}SUB;

SUB *create_form()
{
SUB *head,*tail,*p;
int num,stime,ttime;
int etime,score,term;
char name[20],kind[10];
int size=sizeof(SUB);
head=tail=NULL;
printf("输入选修课程信息:\n");
scanf("%d%s%s%d%d%d%d%d",&num,name,kind,&stime,&ttime,&etime,&score,&term);
while(num!=0){
p=(SUB *)malloc(size);
p->num=num;
strcpy(p->name,name);
strcpy(p->kind,kind);
p->stime=stime;
p->ttime=ttime;
p->etime=etime;
p->score=score;
p->term=term;
if(head==NULL)
head=p;
else
tail->next=p;
tail=p;