try
{
double money = 0;
string leixing = "";
double sale = 0;
Console.WriteLine("魔法师迷你游戏平台>>>>>>>>>游戏币支付");
Console.WriteLine(" ");
Console.WriteLine("请选择您要玩的游戏类型");
Console.WriteLine(@"
1.棋牌类
2.休闲类");
int num = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入您的游戏时长");
switch (num)
{
case 1:
leixing = "棋牌";
money = 10;
break;
case 2:
leixing = "休闲";
money = 20;
break;
default:
Console.WriteLine("请输入1或2,否则无效");
break;
int time = Convert.ToInt32(Console.ReadLine());
bool a = (time > 10);
bool b = (time <= 10);
if (a)
{
money = money * time * 0.5;
sale = 5;
}
else
{
if (b)
money = money * time * 0.8;
sale = 8;
}
Console.WriteLine("您玩的是{0}类游戏,时长是{1},可以享受{2}折优惠,您需要支付{3}个游戏币", leixing, time, sale, money);
}
}
catch
{
Console.WriteLine("您输入的程序错误");
}
Console.ReadKey();
网友评论