期中
try
{
double money = 0;
string xiangmu = "";
double dazhe = 0;
Console.WriteLine("<游戏平台>游戏币支付");
Console.WriteLine("请选择你玩的游戏类型:");
Console.WriteLine(" 1.牌类");
Console.WriteLine(" 2.休闲竞技类");
int n = Convert.ToInt32(Console.ReadLine());
double t = Convert.ToDouble(Console.ReadLine());
switch (n)
{
case 1:
xiangmu = "牌类";
break;
case 2:
xiangmu = "休闲竞技类";
break;
}
if (n == 1)
{
if (t < 10)
{
dazhe = 0.8;
}
else
{
dazhe = 0.5;
}
money = t * dazhe * 10;
}
else
{
if (t < 10)
{
dazhe = 0.8;
}
else
{
dazhe = 0.5;
}
money = t * dazhe * 20;
}
Console.WriteLine("你玩的是{0}游戏,时长是{1},可以享受{2}折优惠", xiangmu, t, dazhe);
Console.WriteLine("你需要支付{0}个游戏币", money);
Console.ReadKey();
}
catch
{
Console.WriteLine("请输入1和2,否则无效");
Console.WriteLine("请输入您的游戏时长:");