Click here to Skip to main content
15,886,632 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The goalis to build a quiz that will keep score. However, after the first run through the user need to have a second go around for the questions answered wrong.
How do I....
1. buid a scorecard that will give only the number of correct answers out of 10, ie.. 2 of 10, 8 of 10.
2. Create a second run through for the questions that were answered wrong
<pre>using System;
using System.Linq;

namespace Checkpoint_3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Quiz");
            //Variables
            bool answerCorrect = false; // will be used to evaluate if answer is correct or not
            string[] questions = { "2+2=", "4x5=", "8+2=", "2x100=", "3+3=", "2+100", "2-2=", "1+2=", "3x3=15", "45-5+8=48" }; // will be questions used on test. 8 Multiple choice and 2 true/false
            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" }; // these will stand as answer bank for all questions
            string [] correctanswer = { "a", "b", "d", "b", "c", "d", "c", "a", "false", "true" }; //these are the correct answers to all the question. any other selections will be countd as incorrect
            int[] scoreCard = { }; // everyone starts with 0 correct out of ten. once quiz is completed score will be listed as 1-10. 
            
            
            

            //Welcome To Program
            Console.WriteLine("Ryan Hinds, ENGR101- Quiz");
            Console.WriteLine();


            
            for (int i = 0; i < 10; i++)
            {
                
                Console.WriteLine(questions[i]);
                Console.WriteLine();
                Console.WriteLine(answers[i]);
                Console.WriteLine("Answer");
               
                string input = Console.ReadLine(); char letter; char.TryParse(input, out letter);
                if (input==correctanswer[i])
                {
                    Console.WriteLine(" You Are Correct");
                    Addscore(scoreCard[i]);
                }
                else
                    Console.WriteLine("Wrong");
                


                    Console.WriteLine();
                Console.WriteLine();
                

            }
           

            Console.ReadKey();

        }

        
    }
}


What I have tried:

I've gotten the first part up and running
Posted
Updated 5-Jan-18 13:56pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900