2023-04-01

Want Answer to match with randomly generated question

I'm making a quiz and I have randomly generated a question from a pool of 15. The correct answer is in a separate list but they all match up i.e. Answer[0] is the correct answer for Question[0].

Random random = new Random();
lblQuestion.Text = Questions[random.Next(0, Questions.Count - 1)];

btnCorrect.Text = Answers[];
btnIncorrect1.Text = Answers[random.Next(0, Answers.Count - 1)];
btnIncorrect2.Text = Answers[random.Next(0, Answers.Count - 1)];
btnIncorrect3.Text = Answers[random.Next(0, Answers.Count - 1)];

I tried creating an int "a" and having it equal to lblQuestion.Text.Count but this always outputs "2".



No comments:

Post a Comment