初心者向けのケース
8224 ワード
class Program
{
static void Main(string[] args)
{
//
Console.WriteLine("Today,we play one game:");
Console.WriteLine("_________________________________________By Mr.w");
for (int i = 0; i < 10; i++)
{
Console.Write("*");
Thread.Sleep(500);// 0.5
}
Console.WriteLine("The game is staring!");
Random rannum = new Random();
// :
Console.WriteLine("please waiting....catching the first number");
for (int a = 0; a < 5; a++)
{
Console.Write("*");
Thread.Sleep(500);// 0.5
}
Console.WriteLine();
int i1 = rannum.Next(1, 6);
Console.WriteLine("The first number is {0}", i1);
// :
Console.WriteLine("please waiting....catching the second number");
for (int i = 0; i < 5; i++)
{
Console.Write("*");
Thread.Sleep(500);// 0.5
}
Console.WriteLine();
int i2 = rannum.Next(1, 6);
Console.WriteLine("The second number is {0}", i2);
int sum = i1 + i2;
Console.WriteLine("The Sum number is {0}", sum);
if (sum == 7 || sum == 11)
{
Console.WriteLine("congration to Gamer!");
}
if (sum == 2 || sum == 3 || sum == 11)
{
Console.WriteLine("sorry,you are lose.");
}
if (sum == 4 || sum == 5 || sum == 6 || sum == 8 || sum == 9 || sum == 10)
{
int temp=sum;
Console.WriteLine("The Sum number is {0}", temp);
Console.WriteLine("please go on catching...and the next number equal to Sum");
for (int s = 0; s <= 3; s++)
{
i1 = rannum.Next(1, 6);
Console.WriteLine("The first number is {0}", i1);
i2 = rannum.Next(1, 6);
Console.WriteLine("The second number is {0}", i2);
sum = i1 + i2;
Console.WriteLine("The Sum number is {0}", sum);
if (sum == temp)
{
Console.WriteLine("The Gamer is Winer!");
return;
}
if (sum == 7)
{
Console.WriteLine("you are loser!");
return;
}
}
}
}
}