Section 1A:
Hello everyone, how can I get the user to specify the amount of questions? This is the part where I am confused, Basically, the program contains a bank of 100 questions (for now there's only 9 questions) and I would like to let the user specify the amount of questions they want to answer. How would I go about doing this implementing this onto the section of code below?
var questions = new List<Question>()
{
new Question { Text = "Q. [Attack On Titan] Which character is the 'Rogue' Titan?", Answer = "Eren"},
new Question { Text = "Q. [Pokemon] Which Pokemon does Ash use mostly?", Answer = "Pikachu" },
new Question { Text = "Q. [Fairy Tail] Who raised Natsu Dragneel when he was a child?", Answer = "Igneel" },
new Question { Text = "Q. [Death Note] What was Light's surname?", Answer = "Yagami" },
new Question { Text = "Q. [Attack On Titan] Who was Eren's best friend?", Answer = "Armin" },
new Question { Text = "Q. [Attack On Titan] Which character is the'Armored' Titan?", Answer = "Reiner" },
new Question { Text = "Q. [Attack On Titan] Which character is the 'Colossal' Titan?", Answer = "Bertholt" },
new Question { Text = "Q. [Death Note] In the series, there was always a shinigami with Light Yagami, what was their name?", Answer = "Ryuk" },
new Question { Text = "Q. [Attack On Titan] Who gave Mikasa their red scarf?", Answer = "Eren" },
};
Random random = new Random();
int correctAnswers = 0;
foreach (var question in questions.OrderBy(q => random.Next()))
{
Console.WriteLine(question.Text);
string answer = "";
do
{
answer = Console.ReadLine();
if (question.IsCorrect(answer))
{
Console.WriteLine($"That is correct! {++correctAnswers}/100");
Thread.Sleep(800);
Console.Clear();
}
Console.WriteLine("You are incorrect.");
System.Threading.Thread.Sleep(40);
}