1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102
| int main() { MainM(); return 0; }
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 == '.') { 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)。 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<n; i++) { fprintf(fp,"%d,",scores.mistakes[i]); } fputc('\n',fp); fclose(fp); } void studytest() { int i=0,j=0,k=0; int flag=0,n=0,m; text_answer a; char ch1,ans; char choice2; FILE *fp,*fp1; int random[M]; int mis=0,count=1,right=0,score=100; if ((fp1=fopen("C:\\驾校系统资源库\\text.txt","r"))==NULL) { printf("嗯...试题库文件打开失败,请尝试联系管理员"); 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 == '.') { 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) {. ch = 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; } 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; } } printf("请输入用户ID\n"); scanf("%d",&account); system("cls"); fflush(stdin); MIS.userid=account; for(j=0; j<i; j++) { if(misid[j]==account) { break; } } rewind(fp1); for(k=0; k<j; k++) moveToNextLine(fp1); n=Getmis(fp1,mistext); for(m=0; m<n; m++) { MIS.mistakes[m]=mistext[m]; } mistest(n,MIS); fclose(fp1); } int moveToNextLine(FILE *fp) { int c; if(fp == NULL) return -1; while(1) { c = fgetc(fp); if(c == EOF) return EOF; if(c == '\n') break; } return 0; } int Getmis(FILE *fp1,int a[]) { char ch1,ch2,ch3,ch5,ch='a',id1,id2,id3,id4,id5; int i=0,j,k,id,account,ch4; while(ch1!= '\n') { ch = fgetc(fp1); while(ch=='@') { ch1= fgetc(fp1); if(ch1=='\n') break; ch2=fgetc(fp1); if(ch2!=',') { ch3=fgetc(fp1); if(ch3!=',') { ch4=((int)ch1-48)*100+((int)ch2-48)*10+(int)ch3-48; a[i++]=ch4; ch4=fgetc(fp1); continue; } else { ch4=((int)ch1-48)*10+(int)ch2-48; a[i++]=ch4; continue; } } else { ch4=(int)ch1-48; a[i++]=ch4; continue; } } } return i; } void mistest(int n,MISTAKE MIS) { int i=0,j=0,k=0,count2=0; int flag,m; text_answer a; char ch1,ans; char choice2; FILE *fp,*fp1; int random[M]; int mis=0,count=1,right=0,score=100; if ((fp1=fopen("C:\\驾校系统资源库\\text.txt","r"))==NULL) { printf("嗯...试题库文件打开失败,请尝试联系管理员"); 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 == '.') { 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). 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(); }
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; } }
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; }
|