-
Notifications
You must be signed in to change notification settings - Fork 0
/
project6.h
46 lines (28 loc) · 793 Bytes
/
project6.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
46
//
// Keita Nonaka
//
// This is a header file for rational class
// This header is for declaring methods and variables.
//
#ifndef CS255_PROJECT6_H
#define CS255_PROJECT6_H
class Rational{
private:
int numerator; // numerator
int denominator; // denominator
int gcd (int a, int b); // gcd method
public:
Rational(); // constructor
Rational(int a, int b); // constructor
~Rational();
void add(Rational obj); // addition
void sub(Rational obj); // subtraction
void mul(Rational obj); // multiplication
void div(Rational obj); // division
void reciprocal(); // reciprocal
void negate(); // negation
void reduce(int& numer, int& denom);
void finally(); // reduce
void print(Rational obj);
};
#endif //CS255_PROJECT6_H