-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFraction.h
More file actions
30 lines (28 loc) · 1.03 KB
/
Fraction.h
File metadata and controls
30 lines (28 loc) · 1.03 KB
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
#ifndef FRACTION_H
#define FRACTION_H
class Fraction
{
private:
int numerator;
int denominator;
public:
Fraction(int number1=1,int number2=1); //default argument
void set();
void reduction(); //Ô¼·Öº¯Êý
void reciprocal(); //µ¹Êýº¯Êý
friend const Fraction operator+(const Fraction& x,const Fraction& y);
friend const Fraction operator-(const Fraction& x,const Fraction& y);
friend const Fraction operator*(const Fraction& x,const Fraction& y);
friend const Fraction operator/(const Fraction& x,const Fraction& y);
friend const Fraction operator+(const Fraction& x);
friend const Fraction operator-(const Fraction& x);
const bool operator<(const Fraction& x);
const bool operator<=(const Fraction& x);
const bool operator>(const Fraction& x);
const bool operator>=(const Fraction& x);
const bool operator==(const Fraction& x);
const bool operator!=(const Fraction& x);
friend ostream& operator<<(ostream& os, Fraction& com);
friend istream& operator>>(istream& os, Fraction& com);
};
#endif