三、
Double money =0;
string xiangmu="";
double sale =0;
Console.WriteLine("<魔法游戏厅>游戏币支付");
Console.WriteLine("请选择游戏类型:");
Console.WriteLine("1、牌类");
Console.WriteLine("2、休闲竞技类");
int n =Convert .ToInt32 ( Console.ReadLine());
Console.WriteLine("请输入你的游戏时长:");
Double t =Convert .ToDouble ( Console.ReadLine());
switch (n)
{
case 1: xiangmu = "牌类";
break;
case 2: xiangmu = "休闲竞技类";
break;
}
if(n==1)
{
if (t <10)
{
sale=0.8;
}
else
{
sale=0.5;
}
money=tsale10;
}
else
{
if(t<10)
{
sale=0.8;
}
else{sale=0.5;
}
money=tsale20;
}
Console.WriteLine("你玩的是第{0}类游戏,时长为{1},享受{2}折优惠",n,t,sale); Console.WriteLine("你支付{0}个游戏币",money);
Console .ReadKey ();
四、
Console.WriteLine("魔法游戏厅平台>游戏点击率");
Double n = 1;
Double count = 0;
for (n = 1; n < 5; n++)
{
Console.Write ("请输入第{0}个游戏的点击率:", n);
int click = Convert .ToInt32 ( Console.ReadLine ());
if (click > 100)
{
count = count + 1; continue ;
}
}
Console.WriteLine("点击数大于100的游戏有{0}个",count );
Console.WriteLine("点击数大于100的游戏所占的比例为{0}",(count / 4) * 100 + "%"); Console.ReadKey();
五、
Console.WriteLine("请输入用户数量");
int people = Convert.ToInt32(Console .ReadLine ());
int n = 1;
for(n=1;n<=people;n++)
{
Console.WriteLine ("请输入第{0}位用户信息:",n);
Console.Write("请输入用户编码<四位数整>:");
int a = Convert.ToInt32(Console.ReadLine());
Console.Write("请输入用户年龄:");
int b = Convert.ToInt32(Console.ReadLine());
if (b<=10)
{
Console.WriteLine("你的年龄不适合玩该游戏");
continue;
}
Console.Write("请输入用户积分:");
int c= Convert.ToInt32(Console.ReadLine());
Console.WriteLine("您录入的信息是:");
Console.WriteLine("用户编号:{0}"+" "+"年龄:{1}"+" "+"积分:{2}",a,b,c);
}
Console.ReadKey();