#include #include void Mangers() { int n,w=1,flag=0,i=3; char s[8]; char password[7]="1"; do { printf("\n\nEnter password:"); scanf("%s",s); if(!strcmp(s,password)) { flag=1; break; } else { printf("\n\nError! You only have %d times! Enter again:\n",i-1); i--; } } while(i>0); if(!flag) { printf("you have Enter 3 times!"); exit(0); } do { system("cls"); printf("\n\n\t\t*********************管理员菜单***********************\n\n"); printf("\t\t\t\t1---浏览课程\n"); printf("\t\t\t\t2---查询课程\n"); printf("\t\t\t\t3---添加课程\n"); printf("\t\t\t\t4---删除课程\n"); printf("\t\t\t\t5---返回主菜单"); printf("\n\n\t\t******************************************************\n"); printf("Chiose your number(1-5):[ ]\b\b"); scanf("%d",&n); switch(n) { case 1:prin();break; case 2:search();break; case 3:insert();savefile();break; case 4:del();savefile();break; case 5:return; default:; } } while(w==1); } void Students() { int n,w=1; do { system("cls"); puts("\n\n\t\t*********************学生菜单***********************\n\n"); puts("\t\t\t\t1---浏览所有课程\n"); puts("\t\t\t\t2---查询课程信息\n"); puts("\t\t\t\t3---选择选修课程\n"); puts("\t\t\t\t4---浏览我选修的课程\n"); puts("\t\t\t\t5---删除错选课程\n"); puts("\t\t\t\t6---返回主菜单"); puts("\n\n\t\t****************************************************\n"); printf("Chiose your number(1-6):[ ]\b\b"); scanf("%d",&n); switch(n) { case 1:prin();break; case 2:search();break; case 3:choose();break; case 4:prin1();break; case 5:del();savefile1();break; case 6:return; default:; } } while(w==1); } int main() { int n,w=1; do { system("cls"); puts("\n\n\t\t*********************MENU***********************\n\n"); puts("\t\t\t\t1.以管理员身份登录(password 1)\n"); puts("\t\t\t\t2.以学生身份登录\n"); puts("\t\t\t\t3.退出"); puts("\n\n\t\t************************************************\n"); printf("Chiose your number(1-3):[ ]\b\b"); scanf("%d",&n); switch(n) { case 1:Mangers() ;break; case 2:Students();break; case 3:w=0;break; default:; } } while(w==1); return 0; }