Sean+Lee

code using namespace std;
 * 1) include

class Rational { private: int num, den;

public: Rational {}; // Constructor Rational(int a, int b){ num=a; den=b; };     ~Rational {}; // Destructor void SetFrac (int a, int b) {num = a; den = b;}; void Display {cout << num << "/" << den;}; Rational Add(Rational w) { int a, b;          a = (num*w.den)+(w.num*den); b = den*w.den; Rational test(a,b); return test; };     Rational Minus(Rational x) { int a, b;          a = (num*x.den)-(x.num*den); b = den*x.den; Rational test(a,b); return test; };     Rational Multiply(Rational y) { int a, b;          a = num*y.num; b = den*y.den; Rational test(a,b); return test; };     Rational Divide(Rational z) { int a, b;          a = num*z.den; b = den*z.num; Rational test(a,b); return test; };     Rational Simplify { int i=0; while (i < 999999) { i++; if (num%i==0 && den%i==0) { num = num/i; den = den/i; };              if (num%den==0) { num = 1; den = 1; };          };      }; };

int main { int x, y;   Rational R1, R2, R3; cout << "Type a fraction, separate numerator and denominator by a space: "; cin >> x >> y;   R1.SetFrac(x,y); cout << "\nFirst Fraction: "; R1.Display;

cout << "\n\nType another fraction with identical syntax: "; cin >> x >> y;   R2.SetFrac(x,y); cout << "\nSecond Fraction: "; R2.Display;

cout << "\n\n"; R1.Display; cout << " + "; R2.Display; cout << ": "; R3 = R1.Add(R2); R3.Simplify; R3.Display;

cout << "\n\n"; R1.Display; cout << " - "; R2.Display; cout << ": "; R3 = R1.Minus(R2); R1.Simplify; R3.Display;

cout << "\n\n"; R1.Display; cout << " * "; R2.Display; cout << ": "; R3 = R1.Multiply(R2); R1.Simplify; R3.Display;

cout << "\n\n"; R1.Display; cout << " / "; R2.Display; cout << ": "; R3 = R1.Divide(R2); R1.Simplify; R3.Display;

cout << "\n\n"; system("pause"); return 0; }

code Type in the content of your page here.