#include<stdio.h>
#include<stdlib.h>
typedef struct Cou_num
{
int number;
int achieve;
}Cou_num;
typedef struct Student
{
bool sex;
signed int grade;
char name[20];
long Stu_number;
Cou_num nelenum[100];
int nelen;
Student * pnext;
}Student;
typedef struct Couse
{
int num1;
char name1[20];
int credit;
int class_hours;
int nelepeo;
int Melepeo;
Couse * next;
}Couse;
struct Couse *cou_headnode = (Couse *)calloc(1,sizeof(Couse));
struct Student *stu_headnode = (Student *)calloc(1,sizeof(Student));
int couse_count=0;
int stu_count=0;
void Keyboardc()
{
Couse *p = (Couse *)malloc(sizeof(Couse));
if(p == NULL)
{
printf("Keyboardc is error——malloc");
}
printf("\n课程编号\t课程名称\t学分\t学时\t课程人数上限\n");
scanf("%d%s%d%d%d",&p->num1,&p->name1,&p->credit,&p->class_hours,&p->Melepeo);
p->nelepeo = 0;
p->next = cou_headnode->next;
cou_headnode->next = p;
couse_count++;
}
void delc(int num)
{
Couse *pago = cou_headnode;
Couse *pcur = pago->next;
if(!pcur)
{
printf("\n没有课程,无法删除!\n");
return;
}
while(pcur)
{
if(pcur->num1 == num)
{
pago->next = pcur->next;
free(pcur);
pcur = NULL;
printf("已删除该编号课程!\n");
couse_count--;
return;
}
pago = pcur;
pcur= pago->next;
}
printf("课程未找到\n");
}
void InputC()
{
int i;
start:
printf("\t\t\t录入课程信息\n");
printf("\n\n1.从键盘录入\n");
printf("\n2.返回主菜单\n");
scanf("%d",&i);
if(i<1||i>2)
{
printf("输入错误,请重新输入:\n");
goto start;
}
switch(i)
{
case(1):Keyboardc();break;
case(2):break;
}
}
void managementc()
{
int i = 0;
start:
printf("\t\t\t课程管理\n");
printf("1.新增课程\n");
printf("2.删除课程\n");
printf("3.返回主菜单\n");
printf("请选择(1~3):\n");
scanf("%d",&i);
if(i<1||i>3)
{
printf("输入错误,请重新输入:\n");
goto start;
}
switch(i)
{