12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
#include "fraction.h" #include <iostream> using namespace std; fraction::fraction() //default constructor...no incoming parameter {//set variables equal to 0 num=0; denom=1; } fraction::fraction(int n, int d) //constructor {//set variables equal to 0 fraction final; num=n; denom=d; } void fraction::print() const { cout<<num<<"/"<<denom; } fraction fraction::MultipliedBy(fraction f2) const { fraction temp(num*f2.num, denom*f2.denom); fraction Reduce(temp); return temp; } fraction fraction::AddedTo(fraction f2) const { fraction temp(num*f2.denom+denom*f2.num, denom*f2.denom); return temp; } fraction fraction::DividedBy(fraction f2) const { fraction temp(num*f2.denom, denom*f2.num); return temp; } fraction fraction::Subtract(fraction f2) const { fraction temp(num*f2.denom-denom*f2.num, denom*f2.denom); return temp; } fraction fraction::Reduce(int num, int denom) { }