mercredi 7 octobre 2015

A Randomising Of String Array VB

I am creating a program that acts as a question ball. The user will ask a question and then the program will come up with random response. I am struggling with how to get the program to randomly generate a response out of the array I have made. I don't know how to do the string array and make it randomised. I have tried many things but none have worked so here is my basic code.

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()




Aucun commentaire:

Enregistrer un commentaire