我有两个模块,带有一个 if 语句。
这是两个代码片段。
int sum;
        int input;
        singleDigit(ref firstRandom, ref secondRandom);
        Console.Write("{0} + {1} = : ", firstRandom, secondRandom);
        input = Convert.ToInt16(Console.ReadLine());
        sum = firstRandom + secondRandom;
        if (firstRandom + secondRandom == sum)
        {
            checkanswergradeoneaddition();
        }
        else
        {
            checkanswergradeoneadditionFalse();
        }`
这是后者所指的模块。请记住,我从 9 月 2 日起才参加编程课程。
       static void checkanswergradeoneadditionFalse()
    {
        Random rnd = new Random();
        int responseTwo = rnd.Next(0, 3);
            switch (responseTwo)
            {
                case 1:
                    Console.WriteLine("Incorrect, mush!");
                    break;
                case 2:
                    Console.WriteLine("Wrong again, Einstein");
                    break;
                default:
                    Console.WriteLine("Default");
                    break;
            }
    }
它没有按预期工作。