C C++课程设计 单项选择题标准化考试系统.docx
- 文档编号:8401850
- 上传时间:2023-01-31
- 格式:DOCX
- 页数:13
- 大小:18.75KB
C C++课程设计 单项选择题标准化考试系统.docx
《C C++课程设计 单项选择题标准化考试系统.docx》由会员分享,可在线阅读,更多相关《C C++课程设计 单项选择题标准化考试系统.docx(13页珍藏版)》请在冰豆网上搜索。
CC++课程设计单项选择题标准化考试系统
单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不帮就完
设计一个单项选择题标准化考试系统,可以进行试题保存、录入、抽取、答题及判卷等功能。
【基本要求】
1.文件保存试题库。
(每个试题包括题干、4个备选答案、标准答案)
2.试题录入:
可随时增加试题到试题库中
3.试题抽取:
每次从试题库中可以随机抽出N道题(N由键盘输入)
4.答题:
用户可实现输入自己的答案
5.自动判卷:
系统可根据用户答案与标准答案的对比实现判卷并给出成绩。
【其它要求】
1.只能使用C++语言,源程序要有适当的注释,使程序容易阅读
2.至少采用文本菜单界面(如果能采用图形菜单界面更好)
(帮帮啊~~~~~QQ:
183004162)
作者:
tianmin1
2006-6-1312:
02 回复此发言
________________________________________
2回复:
单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不
呵呵,都来网上搜了,
作者:
58.244.28.*
2006-6-1721:
46 回复此发言
________________________________________
3回复:
单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不
要饭的真多
作者:
61.172.82.*
2006-6-1722:
39 回复此发言
________________________________________
4回复:
单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不
#include
#include
#include
structquestion{
charask[200];/*选择题题目*/
charanswer[4][80];/*选择题选项*/
intright;/*正确答案*/
structquestion*next;
};
intMenuChoice(void);
structquestion*InsertList(structquestion*fst,conststructquestion*ad);
structquestion*ListSeek(structquestion*seek,longlen,longmax);
voidGetQuestion(structquestion*src);
voidSaveFile(conststructquestion*ed,FILE*saf);
structquestion*LoadFile(structquestion*td,FILE*laf);
intGetAnswer(void);
voidExplainQuestion(conststructquestion*que,intn);
main()
{
structquestion*start=NULL,temp;
longchoice,line=0,c;
FILE*fp=fopen("kstm.dat","a+");
start=LoadFile(start,fp);
while((choice=MenuChoice())!
=3)
if(choice==1){
GetQuestion(&temp);
start=InsertList(start,&temp);
++line;/*统计列表的长度*/
}
elseif(choice==2){
c=600;
while(c>500||c>line){
printf("请输入要回答的问题数量:
");
scanf("%d",&c);
}
ExplainQuestion(start,line);
}
SaveFile(start,fp);/*进行最后的工作*/
fclose(fp);
return0;
}
/*ListSeek函数确定一个读取答案的位置,len代表要读取的答案数,max代表列表的长度*/
structquestion*ListSeek(structquestion*seek,longlen,longmax)
{
inti;
srand(time(NULL));
while(i=rand()%max+len ; while(i--) seek=seek->next;/*找到指定的位置*/ returnseek; } /*向列表中插入试题*/ structquestion*InsertList(structquestion*fst,conststructquestion*ad) { structquestion*newPtr=(structquestion*)malloc(sizeof(structquestion)); if(newPtr==NULL) exit(0); *newPtr=*ad; newPtr->next=fst; returnnewPtr; } /*获取问题,选项,以及正确答案*/ voidGetQuestion(structquestion*src) { inti=0; printf("请输入选择题题目: \n"); scanf("%s",src->ask); while(i<4){ printf("请输入选项%c的答案: \n",i+'A'); scanf("%s",src->answer[i++]); } src->right=GetAnswer(); } /*从文件中读取题目,将题目添加到列表中*/ structquestion*LoadFile(structquestion*td,FILE*laf) { structquestiontemp; while(fread(&temp,1,sizeof(structquestion),laf)) td=InsertList(td,&temp); returntd; } /*将列表中的试题保存在文件中*/ voidSaveFile(conststructquestion*ed,FILE*saf) { fclose(saf); if((saf=fopen("kstm.dat","w"))==NULL)/*以写的方式重新打开文件*/ return; while(ed){ fwrite(ed,1,sizeof(structquestion),saf); ed=ed->next; } } /*得到选择题的答案(不保证是正确的答案)*/ intGetAnswer(void) { intc=0;/*必须进行初始化,避免出现偶然性的错误*/ fflush(stdin); while(c<'A'||c>'D'){/*确保输入的答案是A,B,C,D中的一个*/ printf("请输入正确的答案: "); scanf("%c",&c); } returnc; } /*回答问题,并统计答对题目数,显示得分*/ voidExplainQuestion(conststructquestion*que,intn) { inti=0,t=n; charresult[1001],*p=result; for(i=0;n--;que=que->next){ printf("%s\nA.%s\nB.%s\nC.%s\nD.%s\n\n",que->ask,que->answer[0],que->answer[1], que->answer[2],que->answer[3]); if((*p=que->right)==(*(p+1)=GetAnswer())) ++i; p+=2; } *p='\0'; printf("\n%-13s%-13s%s\n","标准答案","您的答案","评价"); for(p=result;*p! ='\0';p+=2) printf("%-13c%-13c%s\n",*p,*(p+1),*p==*(p+1)? "正确": "错误"); printf("\n您回答了%d道题,答对%d道题目,得分: %.2f\n\n",t,i,(float)i/t*100.00); } /*选择菜单*/ intMenuChoice(void) { intvalue; printf("1-添加选择题\n2-回答选择题\n3-退出\n"); scanf("%d",&value); returnvalue; } 但是这个程序运行后不能实现随即抽题.... structquestion*ListSeek(structquestion*seek,longlen,longmax) { inti; srand(time(NULL)); while(i=rand()%max+len ; while(i--) seek=seek->next;/*找到指定的位置*/ returnseek; } 作者: 文问007 2007-6-720: 49 回复此发言 ________________________________________ 5回复: 单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不 如果不用统计列表,还有结构体中用指针,又怎么弄呢 作者: tingtingbaling 2007-6-1314: 47 回复此发言 ________________________________________ 6回复3: 单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不 大家都有才学的时候,谁能保证一学就会,况且对大一来说有些情况下课程设计自己根本没招的。 我们都是抱着学习的态度来,怎么能说成要饭! 作者: 58.62.226.* 2007-6-1816: 08 回复此发言 ________________________________________ 7回复4: 单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不 非常感谢 作者: 58.62.226.* 2007-6-1816: 09 回复此发言 ________________________________________ 8回复4: 单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不 太谢谢了真是太好了, 我非常感谢啊, 以后我一定好好学, 要不真费事啊. 作者: 222.163.24.* 2007-7-210: 57 回复此发言 ________________________________________ 9单项选择题标准化考试系统 请问一下怎样使它实现随即抽题 作者: 218.84.75.* 2007-7-518: 37 回复此发言 ________________________________________ 10回复: 单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不 #include #include #include structquestion{ charask[200];/*选择题题目*/ charanswer[4][80];/*选择题选项*/ intright;/*正确答案*/ structquestion*next; }; intMenuChoice(void); structquestion*InsertList(structquestion*fst,conststructquestion*ad); structquestion*ListSeek(structquestion*seek,longlen,longmax); voidGetQuestion(structquestion*src); voidSaveFile(conststructquestion*ed,FILE*saf); structquestion*LoadFile(structquestion*td,FILE*laf); intGetAnswer(void); voidExplainQuestion(conststructquestion*que,intn); main() { structquestion*start=NULL,temp; longchoice,line=0,c; FILE*fp=fopen("kstm.dat","a+"); start=LoadFile(start,fp); while((choice=MenuChoice())! =3) if(choice==1){ GetQuestion(&temp); start=InsertList(start,&temp); ++line;/*统计列表的长度*/ } elseif(choice==2){ c=600; while(c>500||c>line){ printf("请输入要回答的问题数量: "); scanf("%d",&c); } ExplainQuestion(start,line); } SaveFile(start,fp);/*进行最后的工作*/ fclose(fp); return0; } /*ListSeek函数确定一个读取答案的位置,len代表要读取的答案数,max代表列表的长度*/ structquestion*ListSeek(structquestion*seek,longlen,longmax) { inti; srand(time(NULL)); while(i=rand()%max+len ; while(i--) seek=seek->next;/*找到指定的位置*/ returnseek; } /*向列表中插入试题*/ structquestion*InsertList(structquestion*fst,conststructquestion*ad) { structquestion*newPtr=(structquestion*)malloc(sizeof(structquestion)); if(newPtr==NULL) exit(0); *newPtr=*ad; newPtr->next=fst; returnnewPtr; } /*获取问题,选项,以及正确答案*/ voidGetQuestion(structquestion*src) { inti=0; printf("请输入选择题题目: \n"); scanf("%s",src->ask); while(i<4){ printf("请输入选项%c的答案: \n",i+'A'); scanf("%s",src->answer[i++]); } src->right=GetAnswer(); } /*从文件中读取题目,将题目添加到列表中*/ structquestion*LoadFile(structquestion*td,FILE*laf) { structquestiontemp; while(fread(&temp,1,sizeof(structquestion),laf)) td=InsertList(td,&temp); returntd; } /*将列表中的试题保存在文件中*/ voidSaveFile(conststructquestion*ed,FILE*saf) { fclose(saf); if((saf=fopen("kstm.dat","w"))==NULL)/*以写的方式重新打开文件*/ return; while(ed){ fwrite(ed,1,sizeof(structquestion),saf); ed=ed->next; } } /*得到选择题的答案(不保证是正确的答案)*/ intGetAnswer(void) { intc=0;/*必须进行初始化,避免出现偶然性的错误*/ fflush(stdin); while(c<'A'||c>'D'){/*确保输入的答案是A,B,C,D中的一个*/ printf("请输入正确的答案: "); scanf("%c",&c); } returnc; } /*回答问题,并统计答对题目数,显示得分*/ voidExplainQuestion(conststructquestion*que,intn) { inti=0,t=n; charresult[1001],*p=result; for(i=0;n--;que=que->next){ printf("%s\nA.%s\nB.%s\nC.%s\nD.%s\n\n",que->ask,que->answer[0],que->answer[1], que->answer[2],que->answer[3]); if((*p=que->right)==(*(p+1)=GetAnswer())) ++i; p+=2; } *p='\0'; printf("\n%-13s%-13s%s\n","标准答案","您的答案","评价"); for(p=result;*p! ='\0';p+=2) printf("%-13c%-13c%s\n",*p,*(p+1),*p==*(p+1)? "正确": "错误"); printf("\n您回答了%d道题,答对%d道题目,得分: %.2f\n\n",t,i,(float)i/t*100.00); } /*选择菜单*/ intMenuChoice(void) { intvalue; printf("1-添加选择题\n2-回答选择题\n3-退出\n"); scanf("%d",&value); returnvalue; } 怎样使它随即抽题呢 作者: 218.84.75.* 2007-7-518: 42 回复此发言 ________________________________________ ________________________________________ 14回复: 单项选择题标准化考试系统(高手们帮帮啊..小弟我很菜的..不 随即抽题 structquestion*ListSeek(structquestion*seek,longlen,longmax) { inti; srand(time(NULL)); while(i=rand()%max+len ; while(i--) seek=seek->next;/*找到指定的位置*/ returnseek; }
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+课程设计 单项选择题标准化考试系统 C+ 课程设计 单项 选择题 标准化 考试 系统