C语言:驾驶员理论课程模拟考试与学习系统
一、课题内容和要求
驾驶员理论课程模拟考试与学习系统是在Dev C++编译环境下以C语言为编程语言编译完成的,为实现驾驶员科目一自主学习,查询知识和进行模拟考试的系统。同时为了方便驾校管理,加入了管理员模块,方便管理员对题库进行修改和编辑,同时,管理员可以为驾校员工添加新的管理员账户,普通用户可在注册后进入系统可进行自主训练,同时能在查看所有习题进行备考和进行错题重做。
课题基本要求:
(1)提供管理员和用户菜单选项,分别进入不同权限界面;
(2)进入管理员界面需要密码验证,管理员界面负责试题库的管理(修改、查询、删除、增加)以及考试成绩的统计等;
(3)进入用户界面需要输入用户 ID,界面菜单选项具有错题、学习和测验等功能;
(4)用文件保存试题库并可随时增加试题到试题库中;
(5)用户可实现输入自己的答案,系统可根据用户答案与标准答案的对比实现判卷并给出成绩。
课题选做要求:
(1)引进错题系统,可以进行错题重做。(已实现)
(2)用户可查看所有题库并进行学习。(已实现)
(3)用户、管理员ID均相对独立,不可重复,减少管理困难。(已实现)
(4)拥有固定路径的资源库,方便后期对题库等内容进行优化和大面积的软件更新。(已实现)
创新功能与特性:
(1)用户每作答一题都会实时判断并给出实时分数,模拟真实考试场景。
(2)管理员可以添加新的管理员。
(3)参考微软等大型公司软件,界面在优化后更清晰整洁,全新的问候与提示语拉近用户距离感,提高用户使用体验。
二、需求分析
(1)提供可操作的主菜单:输出菜单,用于显示以从文件中加载的总客户信息和若干个可选的功能选项。根据客户输入的选项来运行不同的功能,运行不同的函数。
(2)用户主菜单和分菜单:用户主菜单提供注册和登录两个功能,适用于拥有和未拥有账号的用户进行相关操作。用户分菜单是用户主要功能菜单,负责提供用户所需的模拟测试,错题学习,知识学习功能的引导并实现相应跳转。
(3)管理员主菜单,分菜单以及题库菜单:管理员主菜单适用于管理员登录,仅在资源库文本文件 admin.txt 中存储的管理员才可以进行登录。管理员分菜单为管理员提供给相应的功能,包括对成绩进行查看,添加新管理员,以及进入题库系统。题库菜单是题库系统的专用菜单,仅管理员才可以访问,它提供了对题目进行删除,增加,编辑等功能。
三、概要设计
主要存储结构
typedef struct Admin //管理员信息存储
{char ID[20];char name[20];char password[20];
}Admin;
Admin admin[N];
typedef struct User //用户信息存储char ID[20];char name[20];char password[20];
}User;
User user[N];typedef struct a //试题的结构体
{ char text[M][N]; //存放试题char answer[M]; //存放答案
} text_answer;typedef struct userscore //用户成绩的结构体
{ int userid; //存放用户IDchar username[20]; //存放用户名int score; //存放用户成绩int mistakes[M];
} SCORE;
SCORE scores;typedef struct usermis //用户成绩的结构体
{ int userid; //存放用户IDchar username[20]; //存放用户名int mistakes[M]; //存放用户错题题号
} MISTAKE;
MISTAKE MIS;2.主要函数概要
//系统菜单部分
voidMainM(); //系统总菜单
//用户菜单部分
voidUserSM(); //用户主菜单(注册和登录)
voidUserM(); //用户菜单(知识学习,测验,错题查看,错题重做)
//管理员菜单部分
voidAdminSM(); //管理员总菜单(登录,添加管理员)
voidAdminM(); //管理员分菜单(题库,成绩管理)
voidExerM(); //题库管理菜单(包含增加,删减,编辑)
//用户函数
int login(); //用户登录(ID 密码)、
void regist(); //用户注册
void product_random(int x, int a[]); //题目随机生成
void test(int pja); //考试模块函数
void writescore(SCORE scores); //分数写入
void writemis(SCORE scores,int n); //错题写入
int Getmis(FILE *fp1,int a[]); //错题文件读取
int moveToNextLine(FILE *fp); //文件内容扫描
void Getmistakes(MISTAKE MIS); //错题信息获取
void mistest(int n,MISTAKE MIS); //错题重做模块
void studytest(); //学习系统
void savefile(); //用户信息写入
void readfile(); //用户信息读取
//管理员函数
voidshowscore(); //分数查看
void addexe(); //题目增加
voidadminregist(); //添加管理员
voidadminsavefile(); //管理员信息写入
voidadminreadfile(); //管理员信息读取
voidadminlogin(); //管理员登录 四、源程序代码
//maincontrol.c中的代码
int main()
{MainM();return 0;
}
//user.c中的代码
int number=0;
char passwd[20];
void test(int pja){int i=0,j=0,k=0;int flag,n=0,m;text_answer a;char ch1,ans;char choice2;FILE *fp,*fp1;int random[560];int mis=0,count=1,right=0,score=100;if ((fp1=fopen("C:\\驾校系统资源库\\text.txt","r"))==NULL){ //判断文件是否打开成功printf("嗯...试题库文件打开失败,请尝试联系管理员\n");exit(0);} else {while((ch1=fgetc(fp1))!=EOF)
{ //把题目放到数组中if(ch1=='\n') {i++;j=0;}if(ch1 <= 0 || (ch1 >= '0' && ch1 <= '9') || (ch1 >= 'A' && ch1 <= 'Z') || ch1 == '.')//把题目放到数组中,题目里的汉字在计算机存的码值小于0{a.text[i][j++]=ch1;} else if(ch1>='a'&&ch1<='z') //把答案存到数组中a.answer[k++]=ch1;}fclose(fp1); //关闭文件}i=560;m=100;product_random(i,random); //将随机数放到数组中do {flag=random[n++]; //随机抽题if((flag%5)!=0)。 //判断随机数是否为5的倍数(题目的行号为5的倍数)m++;else {
Reanswer:printf("%d.",count);puts(a.text[flag+0]);printf("\n"); //输出题目和选项puts(a.text[flag+1]);printf("\n");puts(a.text[flag+2]);printf(" E.退出考试");printf("\n");puts(a.text[flag+3]);printf("\n");puts(a.text[flag+4]);printf("\n");printf("你选择:");scanf("%c",&ans);if (ans!='A'&&ans!='B'&&ans!='C'&&ans!='D'&&ans!='E')
{ //判断输入的选项printf("你的选择无效,请重新作答\n");system("pause");system("cls");fflush(stdin);goto Reanswer;}if (a.answer[flag/5]==ans+32) { //判断答案printf("\n选择正确\n\n");right++;} else if(ans=='E') {
Rechoose:system("cls");fflush(stdin);printf("是否确认退出考试?\n\n");printf("A.是 B.否\n\n");scanf("%c",&choice2);if (choice2!='A'&&choice2!='B')
{ //判断输入的选项printf("你的选择无效,我们无法进行相应操作,请重新选择\n");system("pause");system("cls");fflush(stdin);goto Rechoose;}if(choice2=='A') {system("cls");fflush(stdin);break;}if(choice2=='B') {system("cls");fflush(stdin);goto Reanswer;}} else {printf("\n你的选择错误,正确答案为");printf("%c\n\n",a.answer[flag/5]-32);scores.mistakes[mis++]=flag/5; //将错题行数放入数组}score=100-mis;printf("剩余%d道题目 当前分数%d分\n\n",100-count,score);
//输出剩余题目和当前分数count++;system("pause");system("cls");fflush(stdin);}} while(--m);printf("你的考试已结束,您的总分为%d分\n",right);scores.score=right;scores.userid=((int)user[pja].ID[0]-48)*10000+((int)user[pja].ID[1]-48)*1000+((int)user[pja].ID[2]-48)*100+((int)user[pja].ID[3]-48)*10+((int)user[pja].ID[4]-48);strcpy(scores.username,user[pja].name);writescore(scores);writemis(scores,mis);system("pause");printf("你的错题已经记录,你可以进入错题系统查看\n");printf("即将为你返回菜单界面\n");system("pause");system("cls");fflush(stdin);UserM();
}void product_random(int x, int a[])
{ //产生随机数并放进数组srand(time(0));int i, j, temp;for(i = 0; i < x; i++) {temp = rand() % x;for(j = 0; j < i; j++) {if(temp == *(a + j)) {i--;break;} else*(a + i) = temp;}}
}void writescore(SCORE scores) {FILE *fp;if((fp=fopen("C:\\驾校系统资源库\\userscore.txt","a+"))==NULL)
{ //判断文件是否打开成功printf("很抱歉,打开成绩记录文件失败,请尝试创建相关文件以继续使用\n");exit(0);}fprintf(fp,"%d|%s@%d", //将用户信息和成绩写入文本文件scores.userid,scores.username,scores.score);fputc('\n',fp);fclose(fp);
}void writemis(SCORE scores,int n) {FILE *fp;int i=0,j;if((fp=fopen("C:\\驾校系统资源库\\mistakes.txt","a+"))==NULL)
{printf("很抱歉,打开错题记录文件失败,请尝试创建相关文件以继续使用\n");exit(0);}fprintf(fp,"%d|%s@", //将用户信息和错题题号写入文本文件scores.userid,scores.username);for(i=0; i= '0' && ch1 <= '9') || (ch1 >= 'A' && ch1 <= 'Z') || ch1 == '.')//把题目放到数组中,题目里的汉字在计算机存的码值小于0{a.text[i][j++]=ch1;} else if(ch1>='a'&&ch1<='z') //把答案存到数组中a.answer[k++]=ch1;}fclose(fp1);}
while(1)
{Reanswer:printf("%d.",count);puts(a.text[flag+0]);printf("\n"); //输出题目和选项puts(a.text[flag+1]);printf("\n");puts(a.text[flag+2]);printf(" E.退出学习");printf("\n");puts(a.text[flag+3]);printf("\n");puts(a.text[flag+4]);printf("\n");printf("答案为:");printf("%c\n\n",a.answer[flag/5]-32);printf("A.上一题 B.下一题\n\n");scanf("%c",&ans);if (ans!='A'&&ans!='B'&&ans!='E'){ //判断输入的选项printf("你的选择无效,请重新选择。\n");system("pause"); system("cls");fflush(stdin);goto Reanswer;}if (ans=='A') { if(flag==0){printf("注意,这已经是第一题\n");system("pause");system("cls");fflush(stdin);goto Reanswer;}else{flag-=5;system("cls");fflush(stdin);count--;continue;}}else if(ans=='B'){if(flag==(k-1)*5){printf("注意,已经是最后一题\n");system("pause");system("cls");fflush(stdin);goto Reanswer;}else{flag+=5;count++;system("cls");fflush(stdin);continue;}}else if(ans=='E') {
Rechoose:system("cls");fflush(stdin);printf("是否确认退出学习?\n\n");printf("A.是 B.否\n\n");scanf("%c",&choice2);if (choice2!='A'&&choice2!='B') {printf("你的选择无效,请重新选择\n");system("pause");system("cls");fflush(stdin);goto Rechoose;}if(choice2=='A') {system("cls");fflush(stdin);printf("知识学习已结束。\n");system("pause");system("cls"); UserM();break;}if(choice2=='B') {system("cls");fflush(stdin);goto Reanswer;}} else {printf("\n选择错误,正确答案为");printf("%c\n\n",a.answer[flag/5]-32);}flag+=5;}}void regist()
{int i,t;int reg= 1;char key[20]; char account[20];char password[20];printf(" ************************* 现在,让我们开始注册你的账户 *************************\n\n");printf(" 只需要几步简单的操作,你就可以开始使用我们的系统了!请按如下引导操作。\n");printf(" 请注意:你注册的ID必须为5位数字\n");
a: printf(" 请输入ID:");scanf("%s", account);if (strspn(account, "0123456789") != strlen(account)){printf(" ★你输入的ID无效,请重新输入\n\a");goto a; }if(strlen(account)!=5){printf(" ★你输入的ID长度不合规,请重新输入:\n\a");goto a;} for (i = 0; i < number; i++) {if (strcmp(user[i].ID, account) == 0){printf(" ★这个账号已链接到其他账户,请重新输入\n\a"); goto a;}}printf(" 请设置你的密码,请注意,您的密码仅限6位: \n");
b: printf(" 请输入密码:");scanf("%s", password);if(strlen(password)!=6){printf(" ★你输入的密码长度不合规,请重新输入:\n\a");goto b;} do{printf(" 请再次输入您的密码: ");scanf("%s", &key);if(strcmp(key,password) == 0) t = 0;else {t = 1;printf(" 两次输入的密码不一致,请重新输入 :) \n");}}while(t == 1);if (reg) {strcpy(user[number].ID, account);strcpy(user[number].password, password);printf(" 请输入你的用户名: ");scanf("%s",user[number].name);number++;printf(" 搞定!\n");printf(" 你的账户已激活,现在可以开始使用你的系统了。\n") ;system("pause");system("cls");fflush(stdin);}UserSM();
}
int login()
{int log = 0;int i;char account[20];char password[20];printf("\n ************************* 如果你拥有我们的账户,请登录 *************************\n\n");c: printf(" 请输入账号:");scanf("%s", account); printf(" 请输入密码:");scanf("%s", password);for (i = 0; i < number; i++) {if (strcmp(user[i].ID, account) == 0 && strcmp(user[i].password, password) == 0) {printf(" 登录成功,即将进入系统\n"); log = 1;system("pause");system("cls");fflush(stdin);UserM(); return i;}}if(log==0){printf(" 你的用户名或者密码输入错误,请重新输入\n\a");goto c;}return 0;
}void savefile()
{int i = 0;FILE *file;fopen("C:\\驾校系统资源库\\user.txt", "w");for (i = 0; i < number; i++) {fprintf(file, "%s %s %s\n", user[i].ID, user[i].password, user[i].name);}fclose(file);
}
void readfile()
{int i = 0;FILE *file = fopen("C:\\驾校系统资源库\\user.txt", "r");if (file) {while (1) {if (feof(file)) break;i = number;fscanf(file, "%s %s %s\n", user[i].ID, user[i].password, user[i].name);number++;}fclose(file);}
}void Getmistakes(MISTAKE MIS) {FILE *fp1;char ch1,ch2,ch,id1,id2,id3,id4,id5;int i=0,j,k,m,n,id,account;int misid[1000]= {0};int mistext[N];if ((fp1=fopen("C:\\驾校系统资源库\\mistakes.txt","r+"))==NULL) { //判断文件是否打开成功printf("很抱歉,打开错题记录文件失败,请尝试创建相关文件以继续使用\n\a");exit(0);}while(ch != EOF) {. //获取错题文件中的用户IDch = fgetc(fp1);if (!i) {id1 = ch;id2 = fgetc(fp1);id3 = fgetc(fp1);id4 = fgetc(fp1);id5 = fgetc(fp1);id=((int)id1-48)*10000+((int)id2-48)*1000+((int)id3-48)*100+((int)id4-48)*10+(int)id5-48;
//注意转换misid[i++]=id; //存放用户ID}if(ch=='\n') {id1 =fgetc(fp1) ;id2 = fgetc(fp1);id3 = fgetc(fp1);id4 = fgetc(fp1);id5 = fgetc(fp1);id=((int)id1-48)*10000+((int)id2-48)*1000+((int)id3-48)*100+((int)id4-48)*10+(int)id5-48;
//注意转换misid[i++]=id; //存放用户ID}}printf("请输入用户ID\n");scanf("%d",&account);system("cls");fflush(stdin);MIS.userid=account;for(j=0; j= '0' && ch1 <= '9') || (ch1 >= 'A' && ch1 <= 'Z') || ch1 == '.')//把题目放到数组中,题目里的汉字在计算机存的码值小于0{a.text[i][j++]=ch1;} else if(ch1>='a'&&ch1<='z') a.answer[k++]=ch1;}fclose(fp1);}do {flag=MIS.mistakes[count2++];//随机抽题if((flag%1)!=0). //判断随机数是否为5的倍数(题目的行号为5的倍数)n++;else {
Reanswer:printf("%d.",count);puts(a.text[flag*5+0]);printf("\n");puts(a.text[flag*5+1]);printf("\n");puts(a.text[flag*5+2]);printf(" E.退出错题");printf("\n");puts(a.text[flag*5+3]);printf("\n");puts(a.text[flag*5+4]);printf("\n");printf("你选择:");scanf("%c",&ans);if (ans!='A'&&ans!='B'&&ans!='C'&&ans!='D'&&ans!='E') { printf("无效选择!请重新作答!\n");system("pause");system("cls");fflush(stdin);goto Reanswer;}if (a.answer[flag]==ans+32) { //判断答案printf("\n选择正确\n\n");right++;} else if(ans=='E') {
Rechoose:system("cls");fflush(stdin);printf("是否确认退出错题?\n\n");printf("A.是 B.否\n\n");scanf("%c",&choice2);if (choice2!='A'&&choice2!='B') { //判断输入的选项printf("无效选择!请重新选择!\n");system("pause");system("cls");fflush(stdin);goto Rechoose;}if(choice2=='A') {system("cls");fflush(stdin);break;}if(choice2=='B') {system("cls");fflush(stdin);goto Reanswer;}} else {printf("\n选择错误,正确答案为");printf("%c\n\n",a.answer[flag/5]-32);}score=100-mis;count++;system("pause");system("cls");fflush(stdin);}} while(--n);printf("错题重做已结束,请继续学习,即将返回主界面。");system("pause");system("cls");fflush(stdin);UserM();
}
//admin.c中的代码
int num=0;
void showscore()
{FILE *fp;char ch;fp=fopen("C:\\驾校系统资源库\\userscore.txt", "r");if (fp==0){printf("抱歉,打开成绩记录文件失败,请尝试创建相关文件以继续使用");exit(1);}printf("你的组织内的用户成绩如下:\n");printf("提示:‘@’后是你组织成员的考试分数:\n"); printf("\n"); while ((ch=fgetc(fp))!=EOF){putchar(ch);}
putchar('\n');
fclose(fp);
system("pause");
system("cls");
fflush(stdin);
AdminM();
}void addexe()。 //添加习题{FILE *fp1;char topic[N];char choice1[N];char choice2[N];char choice3[N];char choice4[N];char answer;int a;if ((fp1=fopen("C:\\驾校系统资源库\\text.txt","a+"))==NULL) { /*判断文件是否打开成功*/printf("嗯...试题库文件打开失败,请尝试联系管理员\n");exit(0);}
do{printf("请输入题目:\n\n");gets(topic);printf("\n"); fprintf(fp1,"%s",topic);fputc('\n',fp1);fflush(stdin);printf("请输入选项A:\n\n");gets(choice1);printf("\n"); fprintf(fp1,"A、%s",choice1);fputc('\n',fp1);fflush(stdin);printf("请输入选项B:\n\n");gets(choice2);printf("\n"); fprintf(fp1,"B、%s",choice2);fputc('\n',fp1);fflush(stdin);printf("请输入选项C:\n\n");gets(choice3);printf("\n"); fprintf(fp1,"C、%s",choice3);fputc('\n',fp1);printf("请输入选项D:\n\n");gets(choice4);printf("\n"); fflush(stdin);fprintf(fp1,"D、%s",choice4);
fflush(stdin);
printf("请输入答案:\n\n");
answer=getchar();printf("\n");
fprintf(fp1,"%c",answer);fputc('\n',fp1);
fflush(stdin);printf("题目已成功添加!你是否需要继续添加题目?\n");
printf("1 是 2 否\n");do{scanf("%d",&a);
} while(a!=1&&a!=2);
if(a==1)
{system("cls");fflush(stdin);continue;
}if(a==2)
{system("cls");
fflush(stdin);
printf("试题添加已结束。 \n") ;
break;
}
}while(1);
fclose(fp1);
ExerM();
}void adminregist()
{int i,t;char key[20]; int reg= 1;char account[20];char password[20];printf(" ************************* 现在,让我们开始添加管理员到你的组织 *************************\n");printf(" 只需要几步简单的操作,就可以成功添加新的管理员请按如下引导操作。\n");printf(" 请注意:你注册的ID必须为5位数字\n");
a: printf(" 请输入你想要添加的管理员ID:");scanf("%s", account);if (strspn(account, "0123456789") != strlen(account)){printf(" ★你输入的ID无效,请重新输入\n");goto a; }if(strlen(account)!=5){printf(" ★你输入的ID长度不合规,请重新输入:\n");goto a;} for (i = 0; i < num; i++) {if (strcmp(admin[i].ID, account) == 0){printf("此管理员用户已存在,请尝试添加其他用户\n"); goto a;}}printf(" 请输入您的密码,请注意,您的密码仅限6位: \n");
b: printf("请输入密码:");scanf("%s", password);if(strlen(password)!=6){printf(" ★你输入的密码长度不合规,请重新输入:\n");goto b;} do{printf(" 请再次输入您的密码: ");scanf("%s", &key);if(strcmp(key,password) == 0) t = 0;else {t = 1;printf(" 两次输入的密码不一致,请重新输入 :) \n");}}while(t == 1);if (reg) {strcpy(admin[num].ID, account);strcpy(admin[num].password, password);printf(" 请输入你的用户名: ");scanf("%s",admin[num].name);num++;printf(" 搞定!\n"); printf(" 管理员添加成功,现在可以开始管理系统了\n");system("pause");system("cls");fflush(stdin);}AdminM();
}
void adminsavefile()
{int i = 0;FILE *file = fopen("C:\\驾校系统资源库\\admin.txt", "w");for (i = 0; i < num; i++) {fprintf(file, "%s %s %s\n", admin[i].ID, admin[i].password, admin[i].name);}fclose(file);
}
void adminreadfile()
{int i = 0;FILE *file = fopen("C:\\驾校系统资源库\\admin.txt", "r");if (file) {while (1) {if (feof(file)) break;i = num;fscanf(file, "%s %s %s\n", admin[i].ID, admin[i].password, admin[i].name);num++;}fclose(file);}
}
void adminlogin()
{int log = 0;int i;char account[20];char password[20];printf("\n ************************* 如果你拥有管理员账户,请登录 *************************\n");c: printf(" 请输入账号:");scanf("%s", account); printf(" 请输入密码:");scanf("%s", password);for (i = 0; i < num; i++) {if (strcmp(admin[i].ID, account) == 0 && strcmp(admin[i].password, password) == 0) {printf(" 登录成功,即将进入系统\n"); log = 1;system("pause");system("cls");fflush(stdin);AdminM();}}if(log==0){printf(" 你的用户名或者密码输入错误,请重新输入\n");goto c;}
}
//menu.c中的代码
int cyn;
//总菜单
void MainM()
{int n;printf("************ 欢迎使用 驾考通·驾驶员科目一模拟系统 ****************\n");printf("* *\n");printf("* 1 管理员点这里 2 普通用户点这里 *\n");printf("* *\n");printf("* 0 退出程序 *\n");printf("* *\n");printf("*******************************************************************\n");do {scanf("%d",&n);} while (n!=1&&n!=2&&n!=0);//读取用户输入的值,并进行相应跳转switch (n){case 1:printf("正在进入管理员系统,请稍候...\n");system("CLS");AdminSM(); break;case 2:printf("正在进入用户系统,请稍候...\n");system("CLS");UserSM();break;case 0:printf("程序已退出!\n\a");break;}
}//用户部分//用户主菜单
void UserSM()
{int a;printf("************************* 欢迎! *********************************\n");printf("* *\n");printf("* 1 我已经拥有账号(登录) 2 没有账号?(注册一个!) *\n");printf("* *\n");printf("* 0 返回 *\n");printf("* *\n");printf("*******************************************************************\n");do {scanf("%d",&a);} while (a!=1&&a!=2&&a!=0);switch (a){case 1:system("cls");fflush(stdin);readfile();cyn=login();//登录系统(已完成) break;case 2:system("cls");fflush(stdin);readfile();regist();savefile();//注册系统(已完成) break;case 0:system("cls");fflush(stdin);MainM();//返回主菜单(已完成)}
}//用户分菜单
void UserM()
{int a;printf("********************** 祝你学习愉快 ************************\n");printf("* *\n");printf("* 1 知识学习 2 模拟测试 *\n");printf("* 3 错题重做 *\n");printf("* *\n");printf("* 0 退出登录 *\n");printf("* *\n");printf("****************************************************************\n");do {scanf("%d",&a);} while (a!=1&&a!=2&&a!=0&&a!=3&&a!=4);switch (a){case 1:system("cls");fflush(stdin);studytest(); //学习系统(已完成) break;case 2:system("cls");fflush(stdin);test(cyn);//测验系统(已完成)break;case 3:system("cls");fflush(stdin);Getmistakes(MIS);//错题重做 break;case 0:system("cls");fflush(stdin);UserSM();//返回用户主菜单(已完成) break;}
}//管理员部分//管理员主菜单
void AdminSM()
{int a;printf("************************* 欢迎! ****************************\n");printf("* *\n");printf("* 1 管理员登录 *\n");printf("* *\n");printf("* 0 返回上一级 *\n");printf("* *\n");printf("**************************************************************\n");do {scanf("%d",&a);} while (a!=1&&a!=0);switch (a){case 1:system("cls");fflush(stdin);adminreadfile();//管理员登录(已完成) adminlogin(); break;case 0:system("cls");fflush(stdin);MainM();//返回总菜单 (已完成) break;}
}//管理员分菜单
void AdminM()
{int a;printf("******************** 驾考通·后台管理系统 ********************\n");printf("* *\n");printf("* 1 题库管理 2 成绩查看 *\n");printf("* 3 添加管理员 *\n");printf("* 0 退出登录 *\n");printf("* *\n");printf("*****************************************************************\n");do {scanf("%d",&a);} while (a!=1&&a!=2&&a!=0&&a!=3);switch (a){case 1:printf("请稍等,我们正在进入题库...");printf("\n");printf("\n");printf("\n");system("cls");ExerM() ;//进入题库菜单(已完成) break;case 2:system("cls");fflush(stdin);showscore(); //成绩查看(已完成) break;case 3:system("cls");fflush(stdin);adminreadfile();adminregist();adminsavefile();//添加管理员(已完成) case 0:system("cls");fflush(stdin);AdminSM();//返回管理员主菜单 break;}
}//题库管理菜单
void ExerM()
{int a;printf("********************* 驾考通·题库管理系统 ********************\n");printf("* *\n");printf("* 1 增加试题 2 删除编辑试题 *\n");printf("* 3 返回上页 *\n");printf("* *\n");printf("* 0 退出登录 *\n");printf("* *\n");printf("*****************************************************************\n");do {scanf("%d",&a);} while (a!=1&&a!=2&&a!=0&&a!=3&&a!=4);switch (a){case 1://增加试题(已完成) system("cls");fflush(stdin);addexe(); break;case 2://删除编辑试题(已完成) system("cls");fflush(stdin);printf("题目编辑涉及错题系统变更\n"); printf("请前往文件夹:桌面-驾校系统资源库-text.txt对该文本文件进行修改\n") ;system("pause");system("cls");fflush(stdin);ExerM(); break;case 3:system("cls");fflush(stdin);AdminM();//返回管理员分菜单(已完成) break;case 0:system("cls");fflush(stdin);AdminSM();//返回管理员主菜单(已完成) break;}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
