Skip to content

Instantly share code, notes, and snippets.

@edhedges
Created November 29, 2011 14:44
Show Gist options
  • Save edhedges/1405035 to your computer and use it in GitHub Desktop.
Save edhedges/1405035 to your computer and use it in GitHub Desktop.
Fraction Computation Header file
/**********************************************
* fraction.h: this header file has the private
fields used in fraction.cpp and also has the
prototypes for the functions in fraction.cpp. *
***********************************************/
#ifndef FRACTION_H
#define FRACTION_H
/**********************************************
* class Fraction: this class allows us to make
"Fractions". *
***********************************************/
class Fraction{
/**********************************************
* This is where the private fields are for the
numerator and denominator of a fraction. *
***********************************************/
private:
int num;
int denom;
/**********************************************
* This is where the prototypes of the functions
used in fraction.cpp are declared. *
***********************************************/
public:
void setValues(int, int);
Fraction plus(Fraction);
Fraction minus(Fraction);
Fraction times(Fraction);
Fraction divide(Fraction);
Fraction reduce();
void print(void);
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment