perEmailm, perWeb, perStreaming, perMov, perMuc, perApp
这些变量不能被case d 使用,如果使正常运行!请帮忙改一下,非常感谢。
case 'c':
perEmail =Math.Round(payEmail / paytotal*100);
perWeb = Math.Round(payWeb / paytotal*100);
perStreaming = Math.Round(payStreaming / paytotal*100);
perMov = Math.Round(payMov / paytotal*100);
perMuc = Math.Round(payMuc / paytotal*100);
perApp = Math.Round(payApp / paytotal*100);
break;
case 'd':
Console.WriteLine("Emails " +"(" +perEmail.ToString("N2") + ")"+ "%");
Console.WriteLine("General browsing " + "(" + perWeb.ToString("N2") + ")" + "%");
Console.WriteLine("Video / movie streaming " + "(" + perStreaming.ToString("N2") + ")" + "%");
Console.WriteLine("HD Movie " + "(" + perMov.ToString("N2") + ")" + "%");
Console.WriteLine("Streaming music " + "(" + perMuc.ToString("N2") + ")" + "%");
Console.WriteLine("Downloading apps " + "(" + perApp.ToString("N2") + ")" + "%");
break;
------解决思路----------------------
不明白你为什么要这样写代码
如果是"c"就给变量赋值,如果是"d"就输出这些值
去掉switch,case不行吗
------解决思路----------------------
这个想法很奇特,“计算键”的意义是什么,如果目的是为了查看结果,完全可以设计成直接按“结果键”得到结果(计算+输出)