Fraction Library
A C++ Fraction library.

MFraction.cpp File Reference

This file implementes the interface of the MFraction class. More...

#include "MFraction.h"
#include <string>

Go to the source code of this file.

Functions

bool operator== (const MFraction &left, const MFraction &right)
bool operator!= (const MFraction &left, const MFraction &right)
bool operator< (const MFraction &left, const MFraction &right)
bool operator<= (const MFraction &left, const MFraction &right)
bool operator> (const MFraction &left, const MFraction &right)
bool operator>= (const MFraction &left, const MFraction &right)
MFraction operator+ (const MFraction &left, const MFraction &right)
MFraction operator- (const MFraction &left, const MFraction &right)
MFraction operator* (const MFraction &left, const MFraction &right)
MFraction operator/ (const MFraction &left, const MFraction &right)
ostream & operator<< (ostream &out, const MFraction &fraction)
istream & operator>> (istream &in, MFraction &fraction)

Detailed Description

This file implementes the interface of the MFraction class.

Private and protected members of the class are also implemented in this file.

Definition in file MFraction.cpp.


Function Documentation

bool operator!= ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction object to the left of the operator.
rightMFraction object to the right of the operator.
Returns:
Returns true if the two fraction objects aren't equal. False otherwise.

Definition at line 278 of file MFraction.cpp.

MFraction operator* ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction on the left of the operator
rightMFraction on the right of the operator
Returns:
Returns the reduced product of the two fractions.

Definition at line 322 of file MFraction.cpp.

MFraction operator+ ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction on the left of the operator
rightMFraction on the right of the operator
Returns:
Returns the reduced sum of the two fractions.

Definition at line 310 of file MFraction.cpp.

MFraction operator- ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction on the left of the operator
rightMFraction on the right of the operator
Returns:
Returns the reduced difference of the two fractions.

Definition at line 316 of file MFraction.cpp.

MFraction operator/ ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction on the left of the operator
rightMFraction on the right of the operator
Returns:
Returns the reduced quotient of the two fractions.

Definition at line 328 of file MFraction.cpp.

bool operator< ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction object to the left of the operator.
rightMFraction object to the right of the operator.
Returns:
Returns true if left fraction is less than right fraction. False otherwise.

Definition at line 284 of file MFraction.cpp.

ostream& operator<< ( ostream &  out,
const MFraction fraction 
)
Parameters:
outoutput stream (operation assumes stream is already setup (ie. connected to file, screen etc.)
fractionMFraction object to output.
Returns:
Returns reference to output stream so that for instance, cout << x << y is possible.

Definition at line 336 of file MFraction.cpp.

bool operator<= ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction object to the left of the operator.
rightMFraction object to the right of the operator.
Returns:
Returns true if left fraction is less than or equal to right fraction. False otherwise.

Definition at line 292 of file MFraction.cpp.

bool operator== ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction object to the left of the operator.
rightMFraction object to the right of the operator.
Returns:
Returns true if the two fraction objects are equal. False otherwise.

Definition at line 272 of file MFraction.cpp.

bool operator> ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction object to the left of the operator.
rightMFraction object to the right of the operator.
Returns:
Returns true if left fraction is greater than right fraction. False otherwise.

Definition at line 298 of file MFraction.cpp.

bool operator>= ( const MFraction left,
const MFraction right 
)
Parameters:
leftMFraction object to the left of the operator.
rightMFraction object to the right of the operator.
Returns:
Returns true if left fraction is greater than or equal to right fraction. False otherwise.

Definition at line 304 of file MFraction.cpp.

istream& operator>> ( istream &  in,
MFraction fraction 
)
Parameters:
ininput stream (operation assumes stream is already setup (ie. connected to file, screen etc.)
fractionThe input from stream is assigned to this fraction object.
Returns:
Returns reference to input stream so that for instance, cin >> x >> y is possible.

Definition at line 358 of file MFraction.cpp.