Пример #1
0
        public bool isIllegal(Rational rat)
        {
            bool isillegal;

            if (rat.denominator == 0)
            {
                isillegal = true;
            }
            else
            {
                isillegal = false;
            }

            return isillegal;
        }
Пример #2
0
        public void IncreaseBy(Rational input)
        {
            int numtemp = numerator, dentemp = denominator;
            int innumtemp = input.numerator, indentemp = input.denominator;

            numtemp *= input.denominator;
            dentemp *= input.denominator;

            innumtemp *= denominator;
            indentemp *= denominator;

            numtemp += innumtemp;
            dentemp += indentemp;

            numerator = numtemp;
            denominator = dentemp;
        }