cool / src / lib / GMLMIP0.1 / formulas / rational.h @ 7c4d2eb4
History  View  Annotate  Download (532 Bytes)
1 
#ifndef RATIONAL_H


2 
#define RATIONAL_H

3  
4 
#include <iostream> 
5  
6 
using namespace std; 
7  
8 
class Rational { 
9 
private:

10 
int top;

11 
int bottom;

12 
public:

13 
Rational(){ top=0; bottom=0; }; 
14 
Rational(int i);

15 
Rational(int t, int b){top=t; bottom=b;}; 
16 
int get_top(){ return top;}; 
17 
int get_bot(){ return bottom;}; 
18 
double get();

19 

20 
friend ostream& operator<<(ostream &o, const Rational &r);

21 
friend bool operator==(const Rational &r1, const Rational &r2); 
22 
friend bool operator!=(const Rational &r1, const Rational &r2); 
23 
}; 
24  
25 
#endif

26 
