#includestdio.h#includestdlib.h#includemalloc.h#includestring.h#includetime.hstructtest{charask[500];//选择题题目charanswer1[100];charanswer2[100];charanswer3[100];charanswer4[100];charda[100];inttitle[100];//随机抽题charright[10];}m[1000];voidmenu(){printf(***********单项选择题标准化考试系统³*********\n);printf(*********************************************\n);printf(1.试题录入***\n);printf(2.查看所有试题***\n);printf(3.试题抽取并答题***\n);printf(4.判卷并打分***\n);printf(5.退出系统***\n);printf(********************************************\n);}intinput(intcnt){inti,count,choice=0;printf(开始输入记录...\n);count=cnt;for(i=cnt;i1000;i++){printf(Continue?(1Yes0No):);scanf(%d,&choice);getchar();if(choice==0)break;elseif(choice==1){printf(请输入第%d道题题目,题干和选项:\n,i+1);printf(请输入题目:);gets(m[i].ask);printf(请输入选项A:);gets(m[i].answer1);printf(请输入选项B:);gets(m[i].answer2);printf(请输入选项C:);gets(m[i].answer3);printf(请输入选项D:);gets(m[i].answer4);printf(请输入答案:);scanf(%c,&m[i].right);cnt++;}}if(count!=cnt)printf(\n题目输入成功:);elseprintf(\n未输入记录!);returncnt;}voidlist(intcnt){inti;printf(开始显示所有题目...);printf(\n当前文件夹中所有记录显示如下:\n\n);for(i=0;icnt;i++){printf(第(%d)题目:%s\n,i+1,m[i].ask);printf(A:%s\n,m[i].answer1);printf(B:%s\n,m[i].answer2);printf(C:%s\n,m[i].answer3);printf(D:%s\n,m[i].answer4);getchar();}printf(所有题目显示完成...);}voidrande(intcnt){inti,j,x=1,n,t;inttitle[100];printf(请输入你想抽取的题数:);scanf(%d,&n);if(ncnt)printf(您抽取的题目超过了题目总数);else{for(i=1;i=n;i++){here:x=rand()%n;title[i]=x;for(j=0;ji;j++)if(title[i]==title[j]){gotohere;}printf(=============================================\n);printf(输出抽取到的第%d题目,i);printf(ÌâÄ¿:%s\n,m[x].ask);printf(A:%s\n,m[x].answer1);printf(B:%s\n,m[x].answer2);printf(C:%s\n,m[x].answer3);printf(D:%s\n,m[x].answer4);printf(请输入你的答案:);scanf(%s,m[x].da);printf(=============================================\n);}}printf(´答题成功,按任意键返回主菜单...);}voidask(intcnt){inti,n;intcount=0;printf(请输入已经答题的数目:);scanf(%d,&n);for(i=0;icnt;i++){if(!strcmp(m[i].da,m[i].right)){count++;}}printf(你答对的总题数是%d\n,count);printf(你最后的得分为%d,(100/n)*count);system(pause);}intmain(){FILE*fp;inti=0,count=0,select;fp=fopen(tiku.txt,a+);if(fp==NULL){printf(Fileopenerror!\n);exit(0);}while(!feof(fp)){if(fread(&m[i],sizeof(structtest),1,fp)==1){i++;count++;}}fclose(fp);while(1){printf(当前文件夹总共有%d条记录.\n,count);menu();printf(请输入你的选择:);scanf(%d,&select);switch(select){case1:count=input(count);break;case2:list(count);break;case3:rande(count);break;case4:ask(count);break;case5:fp=fopen(tiku.txt,w);printf(开始保存文件,按任意键继续........);getchar();getchar();for(i=0;icount;i++){fwrite(&m[i],sizeof(structtest),1,fp);}fclose(fp);printf(\n文件保存成功,按任意键退出系统.....);getchar();exit(0);default:printf(输入错误,请重新输入.....);}}}