using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class overflowRange : ApplicationException
{
public overflowRange(string msg)
: base(msg)
{ }
}
class Program
{
static void Main(string[] args)
{
try
{
Console.Write("请输入百分制的成绩:");
double x = double.Parse(Console.ReadLine());
if (x < 0 || x > 100)
{
throw new overflowRange("成绩为0-100!");
}
Console.WriteLine("转换为五分制的成绩为:" + x / 20);
Console.ReadKey();
}
catch (OverflowRange e)
{
Console.WriteLine(e.Message);
}
}
}
}
c#实验7.1百分制转为五分制
最新推荐文章于 2023-03-28 20:13:18 发布