示例#1
0
        static void Main(string[] args)
        {
            Frac a = new Frac(1, 2);
            Frac b = new Frac(2, 4);

            a.imprime();
            b.imprime();
            Frac c = new Frac();

            c = a + b;
            c.imprime();
            Frac d = new Frac();

            d = a - b;
            d.imprime();
            Frac e = new Frac();

            e = a * b;
            e.imprime();
            Frac f = new Frac();

            f = a / b;
            f.imprime();
            Console.ReadKey();
        }
示例#2
0
        public static Frac operator /(Frac x, Frac y)
        {
            Frac result = new
                          Frac(x.num * y.den, x.den * y.num);

            return(result);
        }