期中作业(三)

#代码

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { double zhekou = 0; //折扣 Console.WriteLine("魔法师平台-游戏币支付"); Console.WriteLine("请选择您喜爱的游戏类型:"); Console.WriteLine(@" 1、牌类 2、休闲竞技类"); Console.WriteLine("请选择"); int leixin = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("再输入您的游戏时长"); int shichang = Convert.ToInt32(Console.ReadLine()); switch (leixin) { case 1: leixin = 10; if (shichang > 10) { zhekou = 0.5; Console.WriteLine("您选择的是牌类游戏,时长是" + shichang + "小时,可以享受" + zhekou * 10 + "折优惠,您需要支付" + shichang * zhekou * leixin + "个游戏币"); }else { zhekou = 0.8; Console.WriteLine("您选择的是牌类游戏,时长是" + shichang + "小时,可以享受" + zhekou * 10 + "折优惠,您需要支付" + shichang * zhekou * leixin + "个游戏币"); } break; case 2: leixin = 20; if (shichang <= 10) { zhekou = 0.8; Console.WriteLine("您选择的是休闲竞技类游戏,时长是" + shichang + "小时,可以享受" + zhekou * 10 + "折优惠,您需要支付" + shichang * zhekou * leixin + "个游戏币"); }else { zhekou = 0.5; Console.WriteLine("您选择的是休闲竞技类游戏,时长是" + shichang + "小时,可以享受" + zhekou * 10 + "折优惠,您需要支付" + shichang * zhekou * leixin + "个游戏币"); } break; default: Console.WriteLine("你输入的数字有误"); break; } Console.ReadKey(); } } }

#效果

 

期中作业(三)_第1张图片
图片发自App

你可能感兴趣的:(期中作业(三))