标题:ASP一个多选题判分的问题求解
只看楼主
zsf58
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-7-5
 问题点数:0 回复次数:0 
ASP一个多选题判分的问题求解

各位好,
请教一个问题,考试系统的判分有点问题.判的不准确.请各位帮忙.
本来的判分方法是:少选给四分之一的分数,多选不给分.
各位大虾若能改成:少选或者多选都不给分也可以. 多谢了!
代码如下:
<!--#include file="conn.inc"-->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta http-equiv="Content-Language" content="zh-cn">
</head>

<%
'读入试卷信息
subject=request("subject")
testid=request("testid")
singlecount=request("singlecount")
singleper=request("singleper")
multicount=request("multicount")
multiper=request("multiper")
judgecount=request("judgecount")
judgeper=request("judgeper")
userid=request.cookies("userid")
starttime=request("mystarttime")
endtime=time()
score=0
j=0
'循环求和
for each element in request.form
for i=1 to request.form(element).count
if instr(element,"NO")<>0 then
id=mid(element,3,3)
result=request.form(element)(i)
sql="select * from exam_database where id="& clng(id)
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
if rs("type")="单选题" then
if result=rs("answer") then
score=score+cint(singleper)
end if
end if
if rs("type")="多选题" then
if instr(rs("answer"),result)<>0 then
score=score+cint(multiper)/4
j=j+1
answer=split(rs("answer"),",")
answercount=ubound(answer)+1
if answercount=j then
score=score+cint(multiper)*(1-j/4)
end if
else
score=score-cint(multiper)/4*(j)
end if
end if
if rs("type")="判断题" then
if rs("answer")=result then
score=score+cint(judgeper)
end if
end if
end if
next
next
'储存分数;
sql="select * from exam_score"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs.addnew
rs("userid")=userid
rs("username")=request.cookies("username")
rs("department")=request.cookies("department")
rs("office")=request.cookies("office")
rs("duties")=request.cookies("duties")
rs("subject")=subject
rs("testid")=testid
rs("starttime")=starttime
rs("endtime")=endtime
rs("score")=score
rs.update
rs.close
sql="select * from exam_testuser where testid="& testid & " and userid=" & userid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs("havetest")=1
rs.update
rs.close
response.redirect "displayresult.asp?userid=" & userid & "&testid=" & testid
%>

搜索更多相关主题的帖子: 问题求解 ASP 判分 选题 
2006-07-05 13:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-76679-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.047516 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved