Dodgeram01 Posted August 18, 2002 Posted August 18, 2002 I am in the process of making a Console app which will ask trivial questions (ATV specs mostly). Anyways, I've done a little work with the Random object, and was wondering how one would possibly going about using it so that the program will ask the questions in a random order. Thanks. Quote Dodge Grab Life By The Horns
Moderators Robby Posted August 18, 2002 Moderators Posted August 18, 2002 Are the questions in a database? Quote Visit...Bassic Software
Dodgeram01 Posted August 18, 2002 Author Posted August 18, 2002 No they're not (not that skilled, yet). Quote Dodge Grab Life By The Horns
*Gurus* Derek Stone Posted August 18, 2002 *Gurus* Posted August 18, 2002 Imports System Dim sQuestions() As String = {"Question 1", "Question 2", "Question 3"} Dim r As New Random(DateTime.Now.Ticks) Dim nElement As Decimal = r.Sample * sQuestions.GetUpperBound(0) Console.WriteLine(sQuestions(Decimal.ToInt32(nElement)).ToString) Quote Posting Guidelines
Dodgeram01 Posted August 19, 2002 Author Posted August 19, 2002 Crazed Lunatic, I don't quite understand the sample. :( Also, the complier didn't like the r.sample line. My code basically looks like this: Console.WriteLine("SP4-What size pilot jet does a Sportsman 400 have?") answer = Console.ReadLine If answer = 40 Then Points = Points + 1 'Points is a counter Console.WriteLine("Correct! Total Points: " & Points) Console.ReadLine() Else Console.WriteLine("Incorrect! Answer is: 40") Console.WriteLine("Total Points: " & Points) Console.ReadLine() End If I put the Console.Readline's in there so that the application would pause, and wait for the user to press a key to continue. I'm not sure if there's a better way to do that though. Back to the subject, I'm not sure like if I should put each question and it's answer logic in separate subs, or what the deal is with it. Thank you. Quote Dodge Grab Life By The Horns
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.