1、程序设计实践课程报告 标准化考试系统Xxx学校课 程 报 告课 程 名 称: 程序设计实践 专 业 班 级 : xxxxxxxx 学 生 姓 名 : xxxxxx 学 号 : xxxxxxxxxxxx 任 课 教 师 : xxxxxx 学 期 :xxxxxxxxxxxxxxxxxxxxxxx 1 需求分析1菜单操作:Main函数中实现一级菜单操作,根据用户的选择调用不同的函数进入不同的菜单,实现各种功能显示。主要分学生跟教师两大块功能。2试题操作功能:使用链式结构存储试题,并运用数据结构的知识,对试题节点进行添加,修改,删除,浏览等功能。3.组合试卷功能:使用rand()函数实现随机题号生成,
2、使用time()为随机数种子,使随机数每次运行都发生变化。根据生成的题号把题目加入试卷中。4.查询系统实现模糊查询,输入字符集,搜索出含有该字符集的题目并显示出来,并允许用户查找下一个含有该字符集的题目。2 概要设计学生系统教师系统浏览试卷查询试题组合试卷浏览试题添加试题开始答题浏览试卷系统结构图3 详细设计模糊查询系统:int search(question *thisPoint,question *newPoint) if(!thisPoint) return 0; if(newPoint-title0 != #) if(strstr(thisPoint-title,newPoint-ti
3、tle) return 1; else return 0; if(newPoint-level != 0) if(thisPoint-level = newPoint-level) return 1; else return 0; if(newPoint-chapter0 != #) if(strstr(thisPoint-chapter,newPoint-chapter) return 1; else return 0; 随机组卷系统:extern int length;extern question examPaper100;extern int addExam(question exam
4、Paper,question *&);int intrand(int n) return (int)(n+1)*rand()/(RAND_MAX+1.0);/此函数功能为 返回一个 从0-n的随机数int randExam(question *&lib,question examPaper) question *ptr; ptr = lib; int total=0,i=0,k,p,n,sel; srand(unsigned)clock(); system(cls); if(examPaper0.title0 != 0) cout试卷已存在,无法组卷!next) /算出题库中的总题数 ptr
5、= ptr-next; total+; while(1) system(cls); cout题库总题数:totalendl; coutn; if(ntotal | n100) cout超出试卷范围!endl; Sleep(500); else break; cout1.开始组卷 0.取消endl; coutsel; switch(sel) case 1: cout正在随机组卷,请稍候。endl; Sleep(1000); while(in) /随机组卷 k=0; ptr = lib; do p = intrand(total); /随机抽取题目所在位置 while(ptotal); while
6、(knext; k+; if(addExam(examPaper,ptr) = 1) i+; return 1; case 0: return 0; 学生答题系统extern question examPaper100;extern char answer100;int answerExam(question examPaper,char answer,int wrong)int i=0, count=0,sel,total=0,swit100=0;/count标志回答是否正确 swit标志题目是否已经作答char c;while(1)dosystem(cls);couti+1.examPap
7、eri.titleendl; if(examPaperi.answer10 != #) coutA.examPaperi.answer1endl; if(examPaperi.answer20 != #) coutB.examPaperi.answer2endl; if(examPaperi.answer30 != #) coutC.examPaperi.answer3endl; if(examPaperi.answer40 != #) coutD.examPaperi.answer4endl; if(examPaperi.answer50 != #) coutE.examPaperi.ans
8、wer5endl; cout答案:;if(answeri != 0) coutansweriansweri;/算分机制if(switi = 0) if(answeri = examPaperi.rightAnswer|answeri = examPaperi.rightAnswer+32)counti = 1;else counti = 0;switi = 1;cout1.上一题 2.下一题 3.修改答案 0.提交试卷nendl;coutsel;while(sel3);switch(sel)case 1: if(i 0) i-; else cout已经是第一题!endl; Sleep(500)
9、; break; case 2: if(ilength-1) i+; else cout已经是最后一题!endl; Sleep(500); break;case 3: switi = 0; coutansweri; break;case 0: if(ilength-1) cout你还有length-i-1道题没有完成!endl; coutc; if(c = Y | c = y) for(i=0; inext & !ptr-pre) cout题库为空!pre & ptr-next) ptr = ptr-next; viewLib(ptr); cout-endl; cout1.上一题 2.下一题
10、3.加入试卷 4.随机组卷 0.上一级endl; coutsel; while(sel4); switch(sel) case 1: if(ptr-pre-pre != NULL ) ptr = ptr-pre; else cout已经是第一题!next != NULL) ptr = ptr-next; else cout已经是最后一题!endl; Sleep(500); break; case 3: p = addExam(examPaper,ptr); if(p = 1) cout试题已经成功加入试卷!endl; else if(p = 0) cout此题已经加入试卷endl; else
11、if(p = -1) cout试卷已满!endl; Sleep(500); break; case 4: if(randExam(lib,examPaper) cout随机组卷完毕!pre & !ptr-next) cout题库为空!pre & ptr-next) ptr = ptr-next; viewLib(ptr); cout-endl; cout1.上一题 2.下一题 3.修改试题 4.删除试题 0.上一级endl; coutsel; while(sel4); switch(sel) case 1: if(ptr-pre-pre != NULL ) ptr = ptr-pre; els
12、e cout已经是第一题!next != NULL) ptr = ptr-next; else cout已经是最后一题!pre; deleteLib(ptr); if(ptr1-next) ptr = ptr1-next; else ptr = ptr1; break; case 0: return ptr; break; /查询功能UIvoid search_UI(question *&thisPoint,question *searchPoint) question *ptr,*ptr1 = NULL; ptr = thisPoint; int sel,p,s; if(!ptr-next
13、& !ptr-pre) cout题库为空!pre) ptr = ptr-next; while(ptr-pre) s = search(ptr,searchPoint); if(s) do system(cls); viewLib(ptr); cout1.查找下一个 2.操作 3.加入试卷 0.返回上一级endl; coutsel; while(sel3); switch(sel) case 1: ptr1 = ptr; break; case 2: ptr1 = ptr; /记录当前ptr的值 ptr = manage_exam(ptr); break; case 3: ptr1 = ptr
14、; p = addExam(examPaper,ptr); if(p = 1) cout试题已经成功加入试卷!endl; else if(p = 0) cout此题已经加入试卷endl; else if(p = -1) cout试卷已满!pre & !ptr-next) return; else if(!ptr-next) if(ptr1) ptr = ptr1; cout没有找到该内容!endl; Sleep(500); else system(cls); cout没有找到该内容!next; /主UIvoid main_UI(question *&lib) question *ptr,*se
15、archPoint; int sel,sel1; ptr = lib; for(;) /saveLib(lib); do system(cls); cout-endl; cout 1.添加试题 endl; cout 2.浏览试题 endl; cout 3.组合试卷 endl; cout 4.管理试题 endl; cout 5.查询试题 endl; cout 6.浏览试卷 endl; cout 0.退出系统 endl; cout-endl; coutsel; while(sel6); switch(sel) case 1: do system(cls); addLib(lib); cout1.继
16、续添加 0.返回上一级nsel1; while(sel1=1); break; case 2: ptr = lib; system(cls); if(!ptr-next) cout题库为空!next) viewLib(ptr-next); ptr = ptr-next; cout0.返回上一级nsel1; if(sel1=0) break; case 3: ptr = lib; makeExam(ptr); break; case 4: ptr = lib; manage_exam(ptr); break; case 5: ptr = lib; searchPoint = (question*)malloc(sizeof(question); set_search(searchPoint); search_UI(ptr,searchPoint); break; case 6: system(cls); viewExam(examPaper); cout0.返回上一级endl; coutsel1; if(sel1=0) break; case 0: saveLib(lib); return;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1