int DisplayTeacherOPMenu()
{
int ret = -1;
char buf[4] = "";
system("clear");
printf("************学生信息管理系统*************\n");
printf("* *\n");
printf("* 您正在使用教师身份进行操作 *\n");
printf("* *\n");
printf("* 1.录入学生信息 *\n");
printf("* 2.查看学生信息 *\n");
printf("* 3.修改学生信息 *\n");
printf("* 4.删除学生信息 *\n");
printf("* 5.查看学生排名 *\n");
printf("* 6.修改登录密码 *\n");
printf("* 7.辞职 *\n");
printf("* 0.注销 *\n");
printf("* please input: *\n");
printf("* *\n");
printf("*****************************************\n");
system("tput cup 12 21");
MyGetString(buf, 4);
sscanf(buf, "%d", &ret);
return ret;
}
int TeacherLoop(struct StuHead* pstTea)
{
struct StuHead* pstStuList = NULL;
struct StuHead* pstStuHead = NULL;
struct StuNode* pstStuNode = NULL;
struct TeaNode* pstTeaNode = NULL;
int cmd = -1;
int exitflag = 0;
int id;
while (1) {
pstStuHead = CreateStuListHead();
ReadStuDataFromFile(pstStuHead);
cmd = DisplayTeacherOPMenu();
switch (cmd) {
case 1:
getStuData(pstStuHead);
PrintAllStu(pstStuHead);
break;
case 2:
system("clear");
printf("请输入要查找的学生学号:");
scanf("%d", &id);
pstStuNode = SearchStuNodeByID(pstStuHead, id);
if (pstStuNode == NULL) {
printf("学生不存在!\n");
break;
}
printf("Name:%s ID:%d Sex:%c C:%.1f Math:%.1f Chn:%.1f\n",
pstStuNode->data.name, pstStuNode->data.id,
pstStuNode->data.sex, pstStuNode->data.CScore,
pstStuNode->data.MathScore, pstStuNode->data.ChnScore);
break;
case 3:
//修改学生信息
break;
case 4:
printf("请输入要删除的学生学号:\n");
scanf("%d", &id);
getchar();
pstStuNode = SearchStuNodeByID(pstStuHead, id);
RemoveStuNode(pstStuHead, pstStuNode);
// SaveStuDataToFile(pstStuHead);
break;
case 5:
StuSortMenu(pstStuList);
break;
case 6:
ChangeTeaPassword(pstTeaNode);
break;
case 7:
//辞职
break;
case 0:
exitflag = 1;
break;
}
if (exitflag) {
break;
}
}
return 0;
}