考试系统实验报告.docx

上传人:b****0 文档编号:10076933 上传时间:2023-05-23 格式:DOCX 页数:30 大小:20.03KB
下载 相关 举报
考试系统实验报告.docx_第1页
第1页 / 共30页
考试系统实验报告.docx_第2页
第2页 / 共30页
考试系统实验报告.docx_第3页
第3页 / 共30页
考试系统实验报告.docx_第4页
第4页 / 共30页
考试系统实验报告.docx_第5页
第5页 / 共30页
考试系统实验报告.docx_第6页
第6页 / 共30页
考试系统实验报告.docx_第7页
第7页 / 共30页
考试系统实验报告.docx_第8页
第8页 / 共30页
考试系统实验报告.docx_第9页
第9页 / 共30页
考试系统实验报告.docx_第10页
第10页 / 共30页
考试系统实验报告.docx_第11页
第11页 / 共30页
考试系统实验报告.docx_第12页
第12页 / 共30页
考试系统实验报告.docx_第13页
第13页 / 共30页
考试系统实验报告.docx_第14页
第14页 / 共30页
考试系统实验报告.docx_第15页
第15页 / 共30页
考试系统实验报告.docx_第16页
第16页 / 共30页
考试系统实验报告.docx_第17页
第17页 / 共30页
考试系统实验报告.docx_第18页
第18页 / 共30页
考试系统实验报告.docx_第19页
第19页 / 共30页
考试系统实验报告.docx_第20页
第20页 / 共30页
亲,该文档总共30页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

考试系统实验报告.docx

《考试系统实验报告.docx》由会员分享,可在线阅读,更多相关《考试系统实验报告.docx(30页珍藏版)》请在冰点文库上搜索。

考试系统实验报告.docx

考试系统实验报告

#include

#include

#include

#include#defineMax500

#defineAdd100

intm;

typedefstructtest_q

{

chartitle[200];

charchoice_a[50];

charchoice_b[50];

charchoice_c[50];

charchoice_d[50];

charother[50];

charanswer[5];

}subject;

typedefstructhead_q

{

subject*p;

}head_q;

head_q*head=(head_q*)malloc(Max*sizeof(head_q));//需要解释............

FILE*fp,*tp;

intinitial()//初始化,把所有题目放进结构数组

{

inti=1,n=Max,flat=0;

if((fp=fopen("12.txt","r"))==NULL)

{

flat=1;

if((fp=fopen("12.txt","w"))==NULL)

{

printf("fileopenerrorone\n");

exit(0);

}

}

if(flat)

{

for(i=1;i<=10;i++)

head[i].p=(subject*)malloc(sizeof(subject));

i=1;

strcpy(head[i].p->title,"It'sseventhirty.I__gotoshooc.\n");

strcpy(head[i].p->choice_a,"A.havegot\n");

strcpy(head[i].p->choice_b,"B.havegotto\n");

strcpy(head[i].p->choice_c,"C.goto\n");

strcpy(head[i].p->choice_d,"D.hadgotto\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B\n");

i=2;

strcpy(head[i].p->title,"Hecameintotheclassroom_____.\n");

strcpy(head[i].p->choice_a,"A.veryupset\n");

strcpy(head[i].p->choice_b,"B.beingupset\n");

strcpy(head[i].p->choice_c,"C.toupset\n");

strcpy(head[i].p->choice_d,"D.tobeupset\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"A\n");

i=3;

strcpy(head[i].p->title,"ThisisthefirsttimethatI___atthemeeting.\n");

strcpy(head[i].p->choice_a,"A.hadspoken\n");

strcpy(head[i].p->choice_b,"B.hbavespoken\n");

strcpy(head[i].p->choice_c,"C.am\n");

strcpy(head[i].p->choice_d,"D.was\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B\n");

i=4;

strcpy(head[i].p->title,"Hiswholeschooleducation___only2yearsbecauseofhisillness.\n");

strcpy(head[i].p->choice_a,"A.addedup\n");

strcpy(head[i].p->choice_b,"B.addedupin\n");

strcpy(head[i].p->choice_c,"C.addedupto\n");

strcpy(head[i].p->choice_d,"D.wasaddedup\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C\n");

i=5;

strcpy(head[i].p->title,"Areyou__yourclassmateswell?

\n");

strcpy(head[i].p->choice_a,"A.gettingalong\n");

strcpy(head[i].p->choice_b,"B.getlongwith\n");

strcpy(head[i].p->choice_c,"C.gettinglongwith\n");

strcpy(head[i].p->choice_d,"D.gettingalongwithlifeinthecountry\n");

strcpy(head[i].p->other,"***********************************\n");

strcpy(head[i].p->answer,"D\n");

i=6;

strcpy(head[i].p->title,"Wearelivinga___\n");

strcpy(head[i].p->choice_a,"A.still\n");

strcpy(head[i].p->choice_b,"B.quiet\n");

strcpy(head[i].p->choice_c,"C.calm\n");

strcpy(head[i].p->choice_d,"D.silent\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B\n");

i=7;

strcpy(head[i].p->title,"Hisbackacheisonly____fornotwateringtheflowers.\n");

strcpy(head[i].p->choice_a,"A.areason\n");

strcpy(head[i].p->choice_b,"B.acause\n");

strcpy(head[i].p->choice_c,"C.anexcuse\n");

strcpy(head[i].p->choice_d,"D.reasons\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C\n");

i=8;

strcpy(head[i].p->title,"Ourteachersmadeus___alotofhomeworkafterachool.\n");

strcpy(head[i].p->choice_a,"A.todo\n");

strcpy(head[i].p->choice_b,"B.doing\n");

strcpy(head[i].p->choice_c,"C.do\n");

strcpy(head[i].p->choice_d,"D.tohavedoneuntilseveno'clock\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C\n");

i=9;

strcpy(head[i].p->title,"Theshop___until7o'clock.\n");

strcpy(head[i].p->choice_a,"A.staysopened\n");

strcpy(head[i].p->choice_b,"B.continuesopen\n");

strcpy(head[i].p->choice_c,"C.staysopen\n");

strcpy(head[i].p->choice_d,"D.continuesopened\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B");

i=10;

strcpy(head[i].p->title,"We______intheneighborhood.\n");

strcpy(head[i].p->choice_a,"A.happenedbeing\n");

strcpy(head[i].p->choice_b,"B.happenedbe\n");

strcpy(head[i].p->choice_c,"C.madedianies\n");

strcpy(head[i].p->choice_d,"D.keptdianies\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C");

for(i=1;i<=10;i++)

{

fputs(head[i].p->title,fp);

fputs(head[i].p->choice_a,fp);

fputs(head[i].p->choice_b,fp);

fputs(head[i].p->choice_c,fp);

fputs(head[i].p->choice_d,fp);

fputs(head[i].p->other,fp);

fputs(head[i].p->answer,fp);

}

if(fclose(fp))

{

printf("filecloseerrorone");

exit(0);

}

}

i=1;

if((flat&&(fp=fopen("12.txt","r"))==NULL))

{

printf("fileopenerrorone\n");

exit(0);

}

if(fp!

=NULL)

{

while(!

feof(fp))

{

head[i].p=(subject*)malloc(sizeof(subject));

fgets(head[i].p->title,200,fp);

fgets(head[i].p->choice_a,50,fp);

fgets(head[i].p->choice_b,50,fp);

fgets(head[i].p->choice_c,50,fp);

fgets(head[i].p->choice_d,50,fp);

fgets(head[i].p->other,50,fp);

fgets(head[i].p->answer,5,fp);

i++;

if(i>=n)

{

head=(head_q*)realloc(head,(n+Add)*sizeof(head_q));

n+=Add;

}

}

if(fclose(fp))

{

printf("filecloseerrorone");

exit(0);

}

i--;

m=i;

}

returnm;

return0;

}intwatch_all()//查看所有试题的函数

{

inti=1,j=1;

for(;i<=m;)

{

if(head[i].p==NULL)

i++;

else

{

printf("%d.%s\n%s\n%s\n",j,head[i].p->title,head[i].p->choice_a,head[i].p->choice_b);

printf("%s\n%s\n%s\n",head[i].p->choice_c,head[i].p->choice_d,head[i].p->other);

i++;

j++;

}

}

return0;

}intrestore()//功能还原函数

{

inti=1,n;

charch[50];

printf("此还原功能主要是给操作不当,导致程序运行错误,崩溃使用!

!

\n");

printf("使用此功能后,之前所有增删题目记录全部清除,\n程序还原为最初的十道英语题\n");

printf("所以此功能请谨慎使用,若确定使用此功能,请输入1\n");

scanf("%d",&n);

if(n==1)

{

for(i=1;i<=10;i++)

head[i].p=(subject*)malloc(sizeof(subject));

i=1;

strcpy(head[i].p->title,"It'sseventhirty.I__gotoshooc.\n");

strcpy(head[i].p->choice_a,"A.havegot\n");

strcpy(head[i].p->choice_b,"B.havegotto\n");

strcpy(head[i].p->choice_c,"C.goto\n");

strcpy(head[i].p->choice_d,"D.hadgotto\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B\n");

i=2;

strcpy(head[i].p->title,"Hecameintotheclassroom_____.\n");

strcpy(head[i].p->choice_a,"A.veryupset\n");

strcpy(head[i].p->choice_b,"B.beingupset\n");

strcpy(head[i].p->choice_c,"C.toupset\n");

strcpy(head[i].p->choice_d,"D.tobeupset\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"A\n");

i=3;

strcpy(head[i].p->title,"ThisisthefirsttimethatI___atthemeeting.\n");

strcpy(head[i].p->choice_a,"A.hadspoken\n");

strcpy(head[i].p->choice_b,"B.hbavespoken\n");

strcpy(head[i].p->choice_c,"C.am\n");

strcpy(head[i].p->choice_d,"D.was\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B\n");

i=4;

strcpy(head[i].p->title,"Hiswholeschooleducation___only2yearsbecauseofhisillness.\n");

strcpy(head[i].p->choice_a,"A.addedup\n");

strcpy(head[i].p->choice_b,"B.addedupin\n");

strcpy(head[i].p->choice_c,"C.addedupto\n");

strcpy(head[i].p->choice_d,"D.wasaddedup\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C\n");

i=5;

strcpy(head[i].p->title,"Areyou__yourclassmateswell?

\n");

strcpy(head[i].p->choice_a,"A.gettingalong\n");

strcpy(head[i].p->choice_b,"B.getlongwith\n");

strcpy(head[i].p->choice_c,"C.gettinglongwith\n");

strcpy(head[i].p->choice_d,"D.gettingalongwithlifeinthecountry\n");

strcpy(head[i].p->other,"***********************************\n");

strcpy(head[i].p->answer,"D\n");

i=6;

strcpy(head[i].p->title,"Wearelivinga___\n");

strcpy(head[i].p->choice_a,"A.still\n");

strcpy(head[i].p->choice_b,"B.quiet\n");

strcpy(head[i].p->choice_c,"C.calm\n");

strcpy(head[i].p->choice_d,"D.silent\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B\n");

i=7;

strcpy(head[i].p->title,"Hisbackacheisonly____fornotwateringtheflowers.\n");

strcpy(head[i].p->choice_a,"A.areason\n");

strcpy(head[i].p->choice_b,"B.acause\n");

strcpy(head[i].p->choice_c,"C.anexcuse");

strcpy(head[i].p->choice_d,"D.reasons\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C\n");

i=8;

strcpy(head[i].p->title,"Ourteachersmadeus___alotofhomeworkafterachool.\n");

strcpy(head[i].p->choice_a,"A.todo\n");

strcpy(head[i].p->choice_b,"B.doing\n");

strcpy(head[i].p->choice_c,"C.do\n");

strcpy(head[i].p->choice_d,"D.tohavedoneuntilseveno'clock\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C\n");

i=9;

strcpy(head[i].p->title,"Theshop___until7o'clock.\n");

strcpy(head[i].p->choice_a,"A.staysopened\n");

strcpy(head[i].p->choice_b,"B.continuesopen\n");

strcpy(head[i].p->choice_c,"C.staysopen\n");

strcpy(head[i].p->choice_d,"D.continuesopened\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"B\n");

i=10;

strcpy(head[i].p->title,"We______intheneighborhood.\n");

strcpy(head[i].p->choice_a,"A.happenedbeing\n");

strcpy(head[i].p->choice_b,"B.happenedbe\n");

strcpy(head[i].p->choice_c,"C.madedianies\n");

strcpy(head[i].p->choice_d,"D.keptdianies\n");

strcpy(head[i].p->other,"**********************************\n");

strcpy(head[i].p->answer,"C");

if

(1)

{

if((fp=fopen("12.txt","w"))==NULL)

{

printf("fileopenerrorone\n");

exit(0);

}

for(i=1;i<=10;i

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2