牛老师第二次作业

namespace 第二次作业
{
    class RandomNumber
    {
        public int Add(int x, int y)
        {
            return x + y;
        }
        public int Sub(int x, int y)
        {
            return x - y;
        }
        public int Mul(int x, int y)
        {
            return x * y;
        }
        public int Del(int x, int y)
        {
            return x / y;
            if (y == 0)
            {
                y = 1;
            }
          
        }
        class Program
        {

            static void Main(string[] args)
            {
                int a, b;
               
                    Console.Write("随机输入一个数:");
                    a = int.Parse(Console.ReadLine());
                    Console.Write("随机输入另一个数<若有除法此处不能为0>:");
                    b = int.Parse(Console.ReadLine());
                    RandomNumber rn = new RandomNumber();
                    Console.WriteLine("这两个随机数的和是:{0}", rn.Add(a, b));
                    Console.WriteLine("这两个随机数的差是:{0}", rn.Sub(a, b));
                    Console.WriteLine("这两个随机数的积是:{0}", rn.Mul(a, b));
                    Console.WriteLine("这两个随机数的商是:{0}", rn.Del(a, b));
                    Console.ReadLine();

                }
            }
        }
    }

预计用时五小时实际用时三十多小时,做了几十个版本,只有这一个能运行出来,

原文地址:https://www.cnblogs.com/yintaiping/p/4856709.html