// Application main program for rantioal number class #include #include "rational_number_class.h" // Minimum function of rational numbers. Rational min(const Rational x, const Rational y) { if (x >= y) return y; else return x; } // Maximum function of rational numbers. Rational max(const Rational x, const Rational y) { if (x >= y) return x; else return y; } int main(void) { Rational a, b, c, d, e; Rational r, s, t; cout << "Enter rational number a (in the form of: p/q): "; cin >> a; cout << "**** a: " << a << endl << endl; cout << "Enter rational number b (in the form of: p/q): "; cin >> b; cout << "**** b: " << b << endl << endl; cout << "Enter rational number c (in the form of: p/q): "; cin >> c; cout << "**** c: " << c << endl << endl; cout << "Enter rational number d (in the form of: p/q): "; cin >> d; cout << "**** d: " << d << endl << endl; cout << "Enter rational number e (in the form of: p/q): "; cin >> e; cout << "**** e: " << e << endl << endl; r = -a + b * c - d / e; cout << "Compute r = -a + b * c - d / e." << endl; cout << "**** The result is: r = " << r << endl << endl; s = max(a / b, c * d) - min(a + c + e, b / d); cout << "Compute s = max(a / b, c * d) - min(a + c + e, b / d)." << endl; cout << "**** The result is: s = " << s << endl << endl; if (a >= b) t = (a / b).rabs(); else t = -(a * b); cout << "Compute if (a >= b) t = |a / b| else t = -(a * b)." << endl; cout << "**** The result is: t = " << t << endl << endl; s += a; cout << "Compute s += a." << endl; cout << "**** The result is: s = " << s << endl << endl; t *= b * e; cout << "Compute t *= b * e." << endl; cout << "**** The result is: t = " << t << endl << endl; system("pause"); return(0); }