2 . 需求分析 2.1 负责的功能模块 内容来自论文无忧网 www.paper51.com n 设计试题生成功能,试题能分布整个教学内容 copyright paper51.com
n 具有试题的答案生成功能 paper51.com n 数据库设计及维护 paper51.com n 程序的其它选项设置 内容来自www.paper51.com 2.2 软件功能分析 copyright paper51.com
根据我负责的功能模块,主要是在试卷的生成上。 copyright paper51.com 1.要显示书本章节信息以供用户使用。而在数据库里章节的存放是没有规则也即它们的顺序不一定按照真实书本的章节顺序来存储的。但是在显示章节信息的时候必须按照书本的章节顺序来显示。所以特别设置如下的数据类型: paper51.com Public Function AddQuestion(ByVal iCount As Long, ByVal QID AsLong, ByVal QType As QuestionType, ByVal Score As Single) As Boolean paper51.com OnError Resume Next http://www.paper51.com DataEnv.rsQstPaper.Open paper51.com DataEnv.rsQstPaper.Filter = "QuestionID = " & CStr(QID)& " and QuestionType = " & CStr(QType) & " " 内容来自论文无忧网 www.paper51.com IfDataEnv.rsQstPaper.RecordCount > 0 Then paper51.com AddQuestion = False 内容来自论文无忧网 www.paper51.com Else http://www.paper51.com DataEnv.rsQstPaper.Filter = "" http://www.paper51.com
DataEnv.rsQstPaper.AddNew http://www.paper51.com DataEnv.rsQstPaper.Fields("PaperSerial") = iCount 内容来自www.paper51.com DataEnv.rsQstPaper.Fields("QuestionID") = QID 内容来自www.paper51.com DataEnv.rsQstPaper.Fields("QuestionType")= QType 内容来自论文无忧网 www.paper51.com
内容来自论文无忧网 www.paper51.com
DataEnv.rsQstPaper.Fields("Score") = Score http://www.paper51.com
copyright paper51.com DataEnv.rsQstPaper.Update copyright paper51.com
AddQuestion = True 内容来自www.paper51.com
End If 内容来自www.paper51.com DataEnv.rsQstPaper.Filter = "" copyright paper51.com DataEnv.rsQstPaper.Close paper51.com End Function 内容来自论文无忧网 www.paper51.com 2.手动生成试卷时要不断的将用户选择的题目临时存储起来,由于记录一道题所包含的信息不是很多,再因为这些信息一会儿还要在“保存答案”里使用,所以我设置了4个的全局变量,定义如下: 内容来自www.paper51.com Public Function AddQuestion(ByVal iCount As Long, ByVal QID AsLong, ByVal QType As QuestionType, ByVal Score As Single) As Boolean 内容来自论文无忧网 www.paper51.com OnError Resume Next http://www.paper51.com
DataEnv.rsQstPaper.Open paper51.com DataEnv.rsQstPaper.Filter = "QuestionID = " & CStr(QID)& " and QuestionType = " & CStr(QType) & " " http://www.paper51.com IfDataEnv.rsQstPaper.RecordCount > 0 Then copyright paper51.com
AddQuestion = False paper51.com Else paper51.com DataEnv.rsQstPaper.Filter = "" 内容来自www.paper51.com DataEnv.rsQstPaper.AddNew copyright paper51.com DataEnv.rsQstPaper.Fields("PaperSerial") = iCount 内容来自论文无忧网 www.paper51.com DataEnv.rsQstPaper.Fields("QuestionID") = QID 内容来自论文无忧网 www.paper51.com DataEnv.rsQstPaper.Fields("QuestionType") = QType 内容来自论文无忧网 www.paper51.com http://www.paper51.com DataEnv.rsQstPaper.Fields("Score") = Score copyright paper51.com 内容来自论文无忧网 www.paper51.com DataEnv.rsQstPaper.Update http://www.paper51.com AddQuestion = True copyright paper51.com End If 内容来自www.paper51.com
DataEnv.rsQstPaper.Filter = "" paper51.com DataEnv.rsQstPaper.Close http://www.paper51.com
End Function 内容来自www.paper51.com
内容来自www.paper51.com
3.在自动生成试卷里最主要的一点就是如何生成一个覆盖知道点广且试题不重复的试卷。其中的关键算法在于如何生成一个不重复的随机数序列。其中变量定义如下: http://www.paper51.com Public Function Create() As Boolean copyright paper51.com On Error Resume Next http://www.paper51.com
If Created Then paper51.com
Create = False 内容来自www.paper51.com ExitFunction copyright paper51.com End If 内容来自www.paper51.com DataEnv.DelQuestion 内容来自论文无忧网 www.paper51.com Dim iCount As Long paper51.com Dim QID As Long http://www.paper51.com Dim Score As Single http://www.paper51.com 内容来自论文无忧网 www.paper51.com http://www.paper51.com http://www.paper51.com For iCount = 1 To FillingNum http://www.paper51.com QID =GetQID(1, Score) 内容来自论文无忧网 www.paper51.com AddQuestion iCount, QID, 1, Score copyright paper51.com Next 内容来自论文无忧网 www.paper51.com copyright paper51.com For iCount = 1 ToRightWrongNum 内容来自论文无忧网 www.paper51.com QID =GetQID(2, Score) copyright paper51.com AddQuestion iCount + FillingNum, QID, 2, Score paper51.com Next 内容来自www.paper51.com For iCount = 1 To SingleSelNum paper51.com QID =GetQID(3, Score) 内容来自www.paper51.com AddQuestion iCount + FillingNum + RightWrongNum, QID, 3, Score 内容来自论文无忧网 www.paper51.com Next copyright paper51.com For iCount = 1 ToMultiSelNum paper51.com QID =GetQID(4, Score) 内容来自论文无忧网 www.paper51.com AddQuestion iCount + FillingNum + RightWrongNum + SingleSelNum, QID, 4,Score 内容来自论文无忧网 www.paper51.com Next http://www.paper51.com For iCount = 1 ToEssayQuesNum 内容来自论文无忧网 www.paper51.com
QID =GetQID(5, Score) 内容来自论文无忧网 www.paper51.com AddQuestion iCount + FillingNum + RightWrongNum + SingleSelNum +MultiSelNum, QID, 5, Score 内容来自论文无忧网 www.paper51.com
Next copyright paper51.com Created = True paper51.com Create = True copyright paper51.com End Function paper51.com |