1
所以我有什么第一后做while循环corect并继续第二个..希望能跟大家能够给我一个手:) 荫一开始C#程序员顺便说一句,P如何在while循环完成后继续执行下一个语句? ?
这里是我的代码:
bool correctAwnser = true;
Console.WriteLine("You selected Easy mode!" + "\n" + "First riddle..");
while (correctAwnser)
{
Console.WriteLine("The more you take, The more you leave behind. What am I?");
if (Console.ReadLine() == "Footsteps")
{
Console.WriteLine("That is correct! that is 5 points!");
points = easyPoints;
Console.WriteLine("You have " + points + " points");
correctAwnser = false;
}
else
{
Console.WriteLine("Sorry that is not correct!");
}
}
while (correctAwnser)
{
Console.WriteLine("Mr.Smith has 4 daughters. Each of his daugthers has a brother. How many children does Mr.Smith has?");
if(Console.ReadLine() == "5 children")
{
Console.WriteLine("That is correct. you gained 5 points!");
points = easyPoints + 5;
Console.WriteLine("You have a total of " + easyPoints + " points");
correctAwnser = false;
}
else
{
Console.WriteLine("Sorry that is not correct!");
}
}
环结合为一,然后设置correctAwnser假 –
创建像AskAndWaitForCorrectAnswer功能(问题的答案),并调用它,你需要尽可能多的时间。 – smibe