【发布时间】:2016-01-04 20:22:44
【问题描述】:
我正在创建一个充当问题球的程序。用户会问一个问题,然后程序会给出随机响应。我正在努力让程序从我制作的数组中随机生成响应。我不知道如何做字符串数组并使其随机化。我尝试了很多东西,但都没有奏效,所以这是我的基本代码。
Sub Main()
Dim userquestion As String
Dim questions(0 To 9) As String
Console.WriteLine("Simply enter a question and it will be answered.")
userquestion = Console.ReadLine()
questions(0) = "Most Likely."
questions(1) = "Outlook Good"
questions(2) = "Yes"
questions(3) = "Sorry, I'm confused ask again later "
questions(4) = "I can't predict now"
questions(5) = "Try to concentrate more so I can use to answer the question."
questions(6) = "Don't COunt on it"
questions(7) = "Yes Do it it will work !"
questions(8) = "My reply is no"
questions(9) = "Sorry, I was sleeping I forgot the question"
Console.WriteLine("The answer is ")
Console.WriteLine("Did you like the answer ? ")
Console.ReadLine()
【问题讨论】:
-
Dim questions(0 To 9) As String-->Dim questions(9) As String
标签: arrays vb.net string random