dimanche 11 août 2019

Can I use an array of chars in my guessing game?

I have a guessing game where I want to randomize the operators too, so that when you guess the right result you get a new calculation with a random operator out of the four: +, -, *, /

        int GuessCount = 0;
        int GuessLimit = 3;

        Random random = new Random();
        double num01 = random.Next(1, 100);
        double num02 = random.Next(1, 100);

    Start:
        try
        {

        Console.Clear();

        Console.WriteLine( "What is the result of " + num01 + "+" + num02 + "?");

        double result = double.Parse(Console.ReadLine());

        while (result == num01 + num02 && GuessCount != GuessLimit)
        {
            Console.WriteLine("Corret!");
             //here is where i want it to go to ex. "num01 - num02"   
            break;               
        }





Aucun commentaire:

Enregistrer un commentaire