I have to build a multiple choice quiz for class in C#. I've declared the variables, this week's project checkpoint is to implement loops into my code. I've read my text book and while it explains loops, it doesn't provide me with an idea to implement it in. I fell i need to utilize the "Foreach Loop", is this correct? Can anyone give me a visual? this is what I have so far. I have no idea how to write or structure a line of code.
using System;
namespace Checkpoint_2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Quiz");
bool answerCorrect = false;
string[] questions = { "2+2=", "4x5=", "8+2=", "2x100=", "3+3=", "2+100", "2-2=", "1+2=", "3x3=15", "45-5+8=48" };
string[] answers = { "a.4 b.2 c.6 d. 10", "a.40 b.20 c.16 d. 11", "a.6 b.12 c.16 d. 10", "a.104 b.200 c.65 d. 102", "a.4 b.2 c.6 d. 10", "a.14 b.200 c.60 d. 102", "a.4 b.2 c.0 d. 10", "a.3 b.2 c.6 d. 102", "true false", " true false" };
string[] correctanswer = { "a", "b", "d", "b", "c", "d", "c", "a", "false", "true" };
int scoreCard = 0;
int[] questionsIncorrect = { };
Console.WriteLine("Ryan Hinds, ENGR101- Quiz");
Console.WriteLine();
Console.WriteLine(questions[0]);
Console.WriteLine("Press any key...");
Console.ReadKey();
}
}
}
What I have tried:
I've dug into my text book and some other online resources. I've also tried plugging in my code, but receive errors