using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BehindClosedDoors
{
class Program
{
static void Main(string[] args)
{
string userValue;
Console.WriteLine("Hello, Welcome to Behind Closed Doors");
Console.WriteLine("A fun and exciting game");
Console.WriteLine("Roll Two dice and the add the value's together and enter that number");
userValue = Console.ReadLine();
do while (userValue == "2")
{
Console.WriteLine("Kiss");
Console.WriteLine("Now roll another number");
Console.ReadLine();
}
while ((userValue = Console.ReadLine()) == "3");
{
Console.WriteLine("Give");
Console.WriteLine("Now roll another number");
Console.ReadLine();
}
while ((userValue = Console.ReadLine()) == "4")
{
Console.WriteLine("Foot Rub");
Console.WriteLine("Now roll another number");
Console.ReadLine();
}
while (userValue == "2" + "3" + "4")
{
//
}
// else if (userValue == "5")
}
}
}
我想使它所以當我運行此代碼,我可以輸入爲2 3或4的很多次,我想並獲得無控制檯關閉在我的文字。現在我可以選擇兩個,然後在第三個關閉的控制檯上。問題與while語句關閉我的控制檯
你都知道,在第一個while循環,你剛纔讀的控制檯,但從來沒有給它分配? – Styxxy
我建議閱讀關於while循環來了解它是如何工作的以及如何使用它。 http://msdn.microsoft.com/en-us/library/2aeyhxcd.aspx – kschieck
看起來就像我需要回去重讀一些我想用循環做的例子。我只學了兩個星期的學習C# – user3323014