-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfraction.h
45 lines (31 loc) · 914 Bytes
/
fraction.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
42
43
44
45
#ifndef FRACTION_H
#define FRACTION_H
#include <iostream>
class fraction
{
public:
fraction();
void setNumerator(int input);
void setDenominator(int input);
int getNumenator();
int getDenominator();
void print();
void reduce();
double toDouble();
friend std::ostream& operator <<(std::ostream& os, const fraction& frac);
friend std::istream& operator >>(std::istream& is, fraction& frac);
fraction operator +(fraction inFraction);
fraction operator -(fraction inFraction);
fraction operator *(fraction inFraction);
fraction operator /(fraction inFraction);
fraction operator +(int inInt);
fraction operator -(int inInt);
fraction operator *(int inInt);
fraction operator /(int inInt);
// fraction operator =(int inInt);
private:
int numerator;
int denominator;
};
int gcd(int first, int second);
#endif // FRACTION_H