I’m new to C# programming so I need to ask C# experts here, what techniques should I use for a quiz game application I’m planning to develop. I’d like my quiz app to be like this:
1.) What is the capital city of UK?
a. London
b. Washington D.C.
c. Tokyo
d. Manila2.) What is the capital city of Russia?
a. Bangkok
b. Beijing
c. Islamabad
d. MoscowETC….
I want the questions to be randomly generated using Rand(). The questions should be randomly placed, not in the order I set up here, but still those 4 choices I declared are the only ones to display in the set of the quiz. If you have any links to tutorials please give me so I can study it. I really love to develop this app, but I don’t have any clue to start this. Any help is truly appreciated. Thanks!
First you should understand your problem. Just check your requirements and think of objects. You certainly have “question” and “answers”. Each Question has 4 possible answers and only one is correct. So a first, very simple approach would look like that.
This is a good start, but not perfect. You could now store the correct answer aswell inside this question object. But to use this new property to its fullest, it would make sense to make our answers a bit more dynamic.
So with this small object we can now create all our questions like this:
How to sort randomly is another topic which is not difficult to find here on SO.
I personaly like icemaninds idea, you can use his answer to improve my basic approach.