0

我正在 Visual Basic 中创建一个测验,我希望一堆问题以新的顺序出现,每次播放时都会一个接一个地显示在输入框中,然后用户将他们的答案放入输入框中。我知道我可以使用一个数组,但是我该怎么做呢?如果没有,还有什么其他方法?

非常感谢。

4

1 回答 1

0

此函数将从参数中提供的列表中随机询问一个问题,并以字符串形式返回答案。

Function AskRandom(rQuestions As Range) As String

 Dim uQuestionsCount As Long
 Dim uQuestion As Long

 uQuestionsCount = rQuestions.Count

 uQuestion = CLng(Rnd() * uQuestionsCount) + 1

 AskRandom = InputBox(rQuestions(uQuestion), "Question")

End Function
于 2013-07-08T10:06:08.030 回答