# Category : Files from Magazines

Archive : CUJ9201.ZIP

Filename : 1001097B

Listing 7

//

// rational.h

//

#include

class rational

{

public:

rational() { }

rational(long n, long d) : num(n), denom(d) { }

rational operator+(rational r);

rational operator-(rational r);

rational operator*(rational r);

rational operator/(rational r);

rational &operator+=(rational r);

rational &operator-=(rational r);

rational &operator*=(rational r);

rational &operator/=(rational r);

void put(FILE *);

private:

long num, denom;

};