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