VB如何做一个选择题的考试系统?我需要源文件,能发我吗?
1个回答
展开全部
Dim ti() As String '题号
Private Sub RandomizeKGT(Kzs As Integer, Kth As Integer)
'随机抽题 kzs 总题,kth抽几条,ti抽的题号
Randomize
ReDim ti(Kth)
For X = 1 To Kth
ti(X) = Int(Kzs * Rnd + 1) '抽指定数kth
Next
restRAD:
For Y = 1 To (Kth - 1)
X = Y
Do While X < Kth
X = X + 1
If ti(Y) = ti(X) Then
Randomize
ti(X) = Int(Kzs * Rnd + 1)
GoTo restRAD '号码重复,重新抽题
End If
Loop
Next
End Sub
Private Sub RandomizeKGT(Kzs As Integer, Kth As Integer)
'随机抽题 kzs 总题,kth抽几条,ti抽的题号
Randomize
ReDim ti(Kth)
For X = 1 To Kth
ti(X) = Int(Kzs * Rnd + 1) '抽指定数kth
Next
restRAD:
For Y = 1 To (Kth - 1)
X = Y
Do While X < Kth
X = X + 1
If ti(Y) = ti(X) Then
Randomize
ti(X) = Int(Kzs * Rnd + 1)
GoTo restRAD '号码重复,重新抽题
End If
Loop
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询