#ifndef __RATIONAL
#define __RATIONAL
#include <iostream.h>
typedef long IntType;
class Rational
{
public:
Rational( const IntType & Numerator = 0 ) :
Numer( Numerator ), Denom( 1 ) { }
Rational( const IntType & Numerator,
const IntType & Denominator ) :
Numer( Numerator ), Denom( Denominator )
{ FixSigns( ); Reduce( ); }
Rational( const Rational & Rhs ) :
Numer( Rhs.Numer ), Denom( Rhs.Denom ) { }
~Rational( ) { }
const Rational & operator= ( const Rational & Rhs );
const Rational & operator+=( const Rational & Rhs );
const Rational & operator-=( const Rational & Rhs );
const Rational & operator/=( const Rational & Rhs );
const Rational & operator*=( const Rational & Rhs );
Rational operator+( const Rational & Rhs ) const;
Rational operator-( const Rational & Rhs ) const;
Rational operator/( const Rational & Rhs ) const;
Rational operator*( const Rational & Rhs ) const;
int operator< ( const Rational & Rhs ) const;
int operator<=( const Rational & Rhs ) const;
int operator> ( const Rational & Rhs ) const;
int operator>=( const Rational & Rhs ) const;
int operator==( const Rational & Rhs ) const;
int operator!=( const Rational & Rhs ) const;
const Rational & operator++( ); Rational operator++( int ); const Rational & operator--( ); Rational operator--( int ); const Rational & operator+( ) const;
Rational operator-( ) const;
int operator!( ) const;
double LongDecimal( ) const { return double( Numer ) / double( Denom ); }
friend ostream & operator<<
( ostream & Out, const Rational & Value );
friend istream & operator>>
( istream & In, Rational & Value );
private:
IntType Numer; IntType Denom;
void FixSigns( ); void Reduce( ); };
#endif