《程序设计实践》课程报告 标准化考试系统.docx

上传人:b****7 文档编号:8783741 上传时间:2023-02-01 格式:DOCX 页数:21 大小:140.51KB
下载 相关 举报
《程序设计实践》课程报告 标准化考试系统.docx_第1页
第1页 / 共21页
《程序设计实践》课程报告 标准化考试系统.docx_第2页
第2页 / 共21页
《程序设计实践》课程报告 标准化考试系统.docx_第3页
第3页 / 共21页
《程序设计实践》课程报告 标准化考试系统.docx_第4页
第4页 / 共21页
《程序设计实践》课程报告 标准化考试系统.docx_第5页
第5页 / 共21页
点击查看更多>>
下载资源
资源描述

《程序设计实践》课程报告 标准化考试系统.docx

《《程序设计实践》课程报告 标准化考试系统.docx》由会员分享,可在线阅读,更多相关《《程序设计实践》课程报告 标准化考试系统.docx(21页珍藏版)》请在冰豆网上搜索。

《程序设计实践》课程报告 标准化考试系统.docx

《程序设计实践》课程报告标准化考试系统

Xxx学校

课程报告

 

课程名称:

程序设计实践

专业班级:

xxxxxxxx

学生姓名:

xxxxxx

学号:

xxxxxxxxxxxx

任课教师:

xxxxxx

学期:

xxxxxxxxxxxxxxxxxxxxxxx

 

1需求分析

1.菜单操作:

Main函数中实现一级菜单操作,根据用户的选择调用不同的函数进入不同的菜单,实现各种功能显示。

主要分学生跟教师两大块功能。

2.试题操作功能:

使用链式结构存储试题,并运用数据结构的知识,对试题节点进行添加,修改,删除,浏览等功能。

3.组合试卷功能:

使用rand()函数实现随机题号生成,使用time()为随机数种子,使随机数每次运行都发生变化。

根据生成的题号把题目加入试卷中。

4.查询系统

实现模糊查询,输入字符集,搜索出含有该字符集的题目并显示出来,并允许用户查找下一个含有该字符集的题目。

2概要设计

 

学生系统

教师系统

 

浏览试卷

查询试题

组合试卷

浏览试题

添加试题

开始答题

浏览试卷

 

系统结构图

3详细设计

模糊查询系统:

intsearch(question*thisPoint,question*newPoint)

{

if(!

thisPoint)return0;

if(newPoint->title[0]!

='#')

{

if(strstr(thisPoint->title,newPoint->title))

return1;

elsereturn0;

}

if(newPoint->level!

=0)

{

if(thisPoint->level==newPoint->level)

return1;

elsereturn0;

}

if(newPoint->chapter[0]!

='#')

{

if(strstr(thisPoint->chapter,newPoint->chapter))

return1;

elsereturn0;

}

}

随机组卷系统:

externintlength;

externquestionexamPaper[100];

externintaddExam(questionexamPaper[],question*&);

intintrand(intn)

{

return(int)((n+1)*rand()/(RAND_MAX+1.0));

}

//此函数功能为返回一个从0-n的随机数

intrandExam(question*&lib,questionexamPaper[])

{

question*ptr;

ptr=lib;

inttotal=0,i=0,k,p,n,sel;

srand((unsigned)clock());

system("cls");

if(examPaper[0].title[0]!

='\0'){

cout<<"试卷已存在,无法组卷!

"<

Sleep(2000);

return0;

}

while(ptr->next)//算出题库中的总题数

{

ptr=ptr->next;

total++;

}

while

(1){

system("cls");

cout<<"题库总题数:

"<

cout<<"请确定试卷题数:

";

cin>>n;

if(n<1||n>total||n>100)

{

cout<<"超出试卷范围!

"<

Sleep(500);

}

elsebreak;

}

cout<<"1.开始组卷0.取消"<

cout<<"您的操作:

";

cin>>sel;

switch(sel){

case1:

cout<<"正在随机组卷,请稍候。

"<

Sleep(1000);

while(i

{

k=0;

ptr=lib;

do{

p=intrand(total);//随机抽取题目所在位置

}while(p<1||p>total);

while(k

{

ptr=ptr->next;

k++;

}

if(addExam(examPaper,ptr)==1)

i++;

}

return1;

case0:

return0;

}

}

学生答题系统

externquestionexamPaper[100];

externcharanswer[100];

intanswerExam(questionexamPaper[],charanswer[],intwrong[])

{

inti=0,count[]={0},sel,total=0,swit[100]={0};//count标志回答是否正确swit标志题目是否已经作答

charc;

while

(1)

{

do{

system("cls");

cout<

if(examPaper[i].answer1[0]!

='#')

cout<<"A."<

if(examPaper[i].answer2[0]!

='#')

cout<<"B."<

if(examPaper[i].answer3[0]!

='#')

cout<<"C."<

if(examPaper[i].answer4[0]!

='#')

cout<<"D."<

if(examPaper[i].answer5[0]!

='#')

cout<<"E."<

cout<<"答案:

";

if(answer[i]!

='\0')cout<

elsecin>>answer[i];

//算分机制

if(swit[i]==0)

if(answer[i]==examPaper[i].rightAnswer||answer[i]==examPaper[i].rightAnswer+32)

count[i]=1;

elsecount[i]=0;

swit[i]=1;

cout<<"1.上一题"<<"2.下一题"<<"3.修改答案"<<"0.提交试卷\n"<

cout<<"您的操作:

";

cin>>sel;

}while(sel<0||sel>3);

switch(sel)

{

case1:

if(i>0)

i--;

else

{

cout<<"已经是第一题!

"<

Sleep(500);

}

break;

case2:

if(i

i++;

else

{

cout<<"已经是最后一题!

"<

Sleep(500);

}

break;

case3:

swit[i]=0;

cout<<"答案:

";

cin>>answer[i];

break;

case0:

if(i

"<

cout<<"你确定要提交试卷吗?

(Y/N):

";

cin>>c;

if(c=='Y'||c=='y')

{

for(i=0;i

{

wrong[i]=count[i];

if(count[i])total++;

}

returntotal;

}

elsebreak;

}

}

}

4调试分析

调试模糊查询功能时,由于考虑不周全,因此出现了搜索出题目后点击查找下一题,不管找到找不到,都会自动结束查询功能。

因为指针走到了链尾就会自动退出该功能,因此,后来加入限制条件,如果没有找到的话,就把指针还原到原来找到的题目的位置,从而点击查找下一题的时候如果没有找到,仍然会显示之前找到的最后一道题,

调试随机组卷系统时,因为随机种子的设置不当,曾导致组卷失败,或者等待时间过长的情况。

后来把随机数种子的设置进行修改,提高了随机数的变化时间间隔,从而提高了组卷的速度,并且组合的题目更接近完全随机,而不会每次运行的随机数一样。

调试学生答题系统的算分机制时,起初设计是直接用标量存储得分,后来发现,若重新阅览已经回答的题目时,分数会增加,导致算分的错误。

经过改进后,采用了数组存储题目的正确性,并加入标志来标志题目是否已经作答,从而保证了算分的正确性。

5测试结果

主UI

模糊查询

随机组卷学生答题

6课程心得总结

通过这次的课程设计,把所学到的知识充分运用到了实际开发当中,对知识体系有了加强,并且运用了模块化编程的思想,对以后的工作有极好的帮助,为以后的学习c++,java,c#等面向对象的设计语言打下基础。

本次的实验结束,我已经具备了基本的系统开发能力,了解了学生考试系统的基本组成。

对以后的系统开发深入学习,与实际开发,有着极大的帮助。

 

7源程序

externquestionexamPaper[100];

externvoidviewLib(question*);

externintaddExam(questionexamPaper[],question*&);

externvoidsaveLib(question*);

externquestion*lib;

externvoidreviseLib(question*&);

externvoiddeleteLib(question*&);

externintsearch(question*,question*);

externvoidset_search(question*&);

externvoidviewExam(questionexamPaper[]);

externvoidsave_exam(questionexamPaper[]);

externintrandExam(question*&,questionexamPaper[]);

//组合试卷UI

voidmakeExam(question*&ptr)

{

intsel,p,n;

for(;;){

do{

system("cls");

if(!

ptr->next&&!

ptr->pre){cout<<"题库为空!

"<

elseif(!

ptr->pre&&ptr->next)ptr=ptr->next;

viewLib(ptr);

cout<<"--------------------------------------------------------------------"<

cout<<"1.上一题"<<"2.下一题"<<"3.加入试卷"<<"4.随机组卷"<<"0.上一级"<

cout<<"请输入操作:

";

cin>>sel;

}while(sel<0||sel>4);

switch(sel)

{

case1:

if(ptr->pre->pre!

=NULL)ptr=ptr->pre;

else{cout<<"已经是第一题!

"<

Sleep(500);

}

break;

case2:

if(ptr->next!

=NULL)ptr=ptr->next;

else{

cout<<"已经是最后一题!

"<

Sleep(500);

}

break;

case3:

p=addExam(examPaper,ptr);

if(p==1)cout<<"试题已经成功加入试卷!

"<

elseif(p==0)cout<<"此题已经加入试卷"<

elseif(p==-1)cout<<"试卷已满!

"<

Sleep(500);

break;

case4:

if(randExam(lib,examPaper))

{

cout<<"随机组卷完毕!

"<

Sleep(500);

}

break;

case0:

return;

}

}

}

//管理试题菜单

question*manage_exam(question*&ptr)

{

intsel;

question*ptr1;

for(;;){

do{

system("cls");

if(!

ptr->pre&&!

ptr->next){cout<<"题库为空!

"<

elseif(!

ptr->pre&&ptr->next)ptr=ptr->next;

viewLib(ptr);

cout<<"--------------------------------------------------------------------"<

cout<<"1.上一题"<<"2.下一题"<<"3.修改试题"<<"4.删除试题"<<"0.上一级"<

cout<<"您的操作:

";

cin>>sel;

}while(sel<0||sel>4);

switch(sel)

{

case1:

if(ptr->pre->pre!

=NULL)ptr=ptr->pre;

else{cout<<"已经是第一题!

"<

Sleep(500);

}

break;

case2:

if(ptr->next!

=NULL)ptr=ptr->next;

else{cout<<"已经是最后一题!

"<

Sleep(500);

}

break;

case3:

reviseLib(ptr);

break;

case4:

ptr1=ptr->pre;

deleteLib(ptr);

if(ptr1->next)ptr=ptr1->next;

elseptr=ptr1;

break;

case0:

returnptr;

break;

}

}

}

//查询功能UI

voidsearch_UI(question*&thisPoint,question*searchPoint)

{

question*ptr,*ptr1=NULL;

ptr=thisPoint;

intsel,p,s;

if(!

ptr->next&&!

ptr->pre)cout<<"题库为空!

"<

elseif(!

ptr->pre)ptr=ptr->next;

while(ptr->pre){

s=search(ptr,searchPoint);

if(s){

do{

system("cls");

viewLib(ptr);

cout<<"1.查找下一个"<<"2.操作"<<"3.加入试卷"<<"0.返回上一级"<

cout<<"您的操作:

";

cin>>sel;

}while(sel<0||sel>3);

switch(sel)

{

case1:

ptr1=ptr;

break;

case2:

ptr1=ptr;//记录当前ptr的值

ptr=manage_exam(ptr);

break;

case3:

ptr1=ptr;

p=addExam(examPaper,ptr);

if(p==1)cout<<"试题已经成功加入试卷!

"<

elseif(p==0)cout<<"此题已经加入试卷"<

elseif(p==-1)cout<<"试卷已满!

"<

Sleep(500);

break;

case0:

return;

}

}

if(!

ptr->pre&&!

ptr->next)

return;

elseif(!

ptr->next)

{

if(ptr1){

ptr=ptr1;

cout<<"没有找到该内容!

"<

Sleep(500);

}

else{

system("cls");

cout<<"没有找到该内容!

"<

Sleep(1000);

return;

}//查找下一个,若没找到保持ptr不变

}

elseptr=ptr->next;

}

}

//主UI

voidmain_UI(question*&lib)

{

question*ptr,*searchPoint;

intsel,sel1;

ptr=lib;

for(;;){

//saveLib(lib);

do{

system("cls");

cout<<"-------------------------------------------------------------------------------"<

cout<<"1.添加试题"<

cout<<"2.浏览试题"<

cout<<"3.组合试卷"<

cout<<"4.管理试题"<

cout<<"5.查询试题"<

cout<<"6.浏览试卷"<

cout<<"0.退出系统"<

cout<<"-------------------------------------------------------------------------------"<

cout<<"您的操作:

";

cin>>sel;

}while(sel<0||sel>6);

switch(sel)

{

case1:

do{

system("cls");

addLib(lib);

cout<<"1.继续添加0.返回上一级\n"<<"您的操作:

";

cin>>sel1;

}while(sel1==1);

break;

case2:

ptr=lib;

system("cls");

if(!

ptr->next)cout<<"题库为空!

"<

while(ptr->next)

{

viewLib(ptr->next);

ptr=ptr->next;

}

cout<<"0.返回上一级\n"<<"您的操作:

";

cin>>sel1;

if(sel1==0)break;

case3:

ptr=lib;

makeExam(ptr);

break;

case4:

ptr=lib;

manage_exam(ptr);

break;

case5:

ptr=lib;

searchPoint=(question*)malloc(sizeof(question));

set_search(searchPoint);

search_UI(ptr,searchPoint);

break;

case6:

system("cls");

viewExam(examPaper);

cout<<"0.返回上一级"<

cout<<"请输入操作:

";

cin>>sel1;

if(sel1==0)break;

case0:

saveLib(lib);

return;

}

}

}

 

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

当前位置:首页 > 初中教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1