zoukankan      html  css  js  c++  java
  • 牛老师第二次作业

    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();

                    }
                }
            }
        }

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

  • 相关阅读:
    45、linux shell命令,ldconfig
    47、linux shell,ln链接
    43、linux shell命令,chmod
    39、linux 进程管理
    46、linux shell命令,chkconfig
    40、linux shell常用函数mkdir,rmdir,mount
    26、linux 几个C函数,nanosleep,lstat,unlink
    38、linux shell常用函数,nice
    44、linux shell命令,ldd
    41、linux shell常用函数,lsof
  • 原文地址:https://www.cnblogs.com/yintaiping/p/4856709.html
Copyright © 2011-2022 走看看