コード例 #1
0
ファイル: RationalNumbers.cs プロジェクト: psychoCS/C-Classes
    static void Main(string[] args)
    {
        Rational x = new Rational();
        Rational y = new Rational(3);
        Rational w = new Rational(9, 8);
        Rational z = new Rational(4, 7);

        Console.WriteLine("So, we have created the 4 rational objects.\n");
        Console.WriteLine($"a:{x}, b:{y}, c:{w}, d{z}\n");

        x.IncreaseBy(w);
        Console.WriteLine($"If we add a nd c the result is {x}.\n");


        z.DecreaseBy(w);
        Console.WriteLine($"If we subtract d nd c the result is {z}.\n");
    }