#include
#include
#include
#include
#include
#define MAX_NAME 20
#define NULL 0
struct course
{
char course_name[MAX_NAME];
int class_num;
int ch_per;
int ex_per;
struct course *next;
};
struct teacher
{
char teacher_num[MAX_NAME];
char teacher_name[MAX_NAME];
struct teacher *next;
struct course *chead;
struct course *ctail;
};
struct teacher *thead,*ttail,*found;
//***********************************************************************
//主菜单
void menu()
{
system("cls");
printf("*************************************\n");
printf("* 1.输入教师信息 *\n");
printf("* 2.插入授课信息 *\n");
printf("* 3.工作量计算与显示 *\n");
printf("* 4.退出 *\n");
printf("*************************************\n");
printf("请输入要操作的序号:");
}
int isExist(char number[]) //判断输入的教师号是否已经存在
{
struct teacher *p;
p=thead;
while(p!=NULL && (strcmp(p->teacher_num,number)!=0)) p=p->next;
found=p;
if(p==NULL)
return 0;
else
return 1;
}
//************************************************************************
//增加教师教学信息模块
void addIn()
{
struct teacher *p;
struct course *pcourse;
char teacher_num[MAX_NAME];
char teacher_name[MAX_NAME];
char course_name[MAX_NAME];
int class_num;
int ch_per;
int ex_per;
while(1)
{
system("cls");
printf("****************************************************\n");
printf("* 输入教师的信息,以输入教师号为#结束输入 *\n");
printf("****************************************************\n");
printf("输入教师号:");
fflush(stdin);
scanf("%s",teacher_num);
if(isExist(teacher_num))
{
printf("!!!该教师号已经存在,请重新输入。\n按任意键重新输入...\n");
getch();
}
else
{
if(strcmp(teacher_num,"#")==0)
{
printf("**************************************************\n");
printf("输入结束。按任意键返回主菜单...\n");
getch();
return;
}
printf("输入教师姓名:");fflush(stdin);scanf("%s",teacher_name);
printf("************************
2021-06-24 15:46:34
7KB
课程设计
1