-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfrac.h
41 lines (31 loc) · 909 Bytes
/
frac.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ==========================================================================
// Author : John P. Gallegos
// Est. No : 801-06-2608
// Email : [email protected]
// ===========================================================================
#include <iostream>
using namespace std;
#ifndef FRAC_H
#define FRAC_H
class Fraction {
private:
int num, denom;
public:
Fraction();
Fraction(int n, int d);
int fracGCD();
void setNum(int n);
void setDenom(int d);
int getNum() const;
int getDenom() const;
void print(ostream & out) const;
Fraction add(const Fraction& F) const;
Fraction sub(const Fraction& F) const;
Fraction mult(const Fraction& F) const;
Fraction div(const Fraction& F) const;
bool gt(const Fraction& F) const;
bool lt(const Fraction& F) const;
void reduce();
};
ostream & operator<<(ostream & out, const Fraction & frac);
#endif