Indentation
This commit is contained in:
parent
8dda4fe71b
commit
aec0995aaf
1 changed files with 171 additions and 177 deletions
|
@ -34,10 +34,10 @@ class fraction {
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
fraction() {
|
fraction() {}
|
||||||
}
|
|
||||||
fraction(const fraction &q) {
|
fraction(const fraction &q) {
|
||||||
signed long long hcf = gcd(q.n, q.d);
|
signed long long hcf = gcd(q.n, q.d);
|
||||||
n = q.n / hcf;
|
n = q.n / hcf;
|
||||||
|
@ -70,15 +70,9 @@ class fraction {
|
||||||
d = q.d;
|
d = q.d;
|
||||||
}
|
}
|
||||||
// Member functions
|
// Member functions
|
||||||
int get_sign() const {
|
int get_sign() const { return (!(n >= 0) != !(d >= 0)) ? -1 : 1; }
|
||||||
return (!(n >= 0) != !(d >=0)) ? -1 : 1;
|
signed long long get_n() const { return n; }
|
||||||
}
|
signed long long get_d() const { return d; }
|
||||||
signed long long get_n() const {
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
signed long long get_d() const {
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
double to_double() const {
|
double to_double() const {
|
||||||
double dec = (double)n / (double)d;
|
double dec = (double)n / (double)d;
|
||||||
return dec;
|
return dec;
|
||||||
|
|
Loading…
Add table
Reference in a new issue