Fraction Class

Previous      Next      f0.cc      frac.0.h      frac.0.cc

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include "frac.0.h"
using namespace std;

int main () {
   Fraction *a = new Fraction(2,3);
   cout << "The a fraction is ";  a->display(); cout << "\n";
	
   Fraction *b = new Fraction(3,4);
   cout << "The b fraction is ";  b->display(); cout << "\n";
	
   Fraction *c = b->times(a);
   b->display(); cout << " * "; a->display(); 
   cout << " = "; c->display(); cout << "\n";
	
   c = b->over(a);
   b->display(); cout << " / "; a->display(); 
   cout << " = "; c->display(); cout << "\n";
	
   c = b->sub(a);
   b->display(); cout << " - "; a->display(); 
   cout << " = "; c->display(); cout << "\n";	

   c = b->plus(a);
   b->display(); cout << " + "; a->display(); 
   cout << " = "; c->display(); cout << "\n";
}