This repository has been archived on 2021-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
FractionTask/fraction.hpp
Tobias Berger 0e6e7268ee division
2021-09-21 09:30:49 +02:00

59 lines
1.4 KiB
C++

#pragma once
#include <QString>
namespace FractionNS {
class Fraction
{
private:
int m_numerator, m_denominator;
void reduce();
public:
Fraction(int, int);
Fraction(int);
Fraction(double);
Fraction(float);
Fraction(const Fraction&);
int getNumerator() const;
int getDenominator() const;
void setNumerator(const int);
void setDenominator(const int);
QString display() const;
bool operator==(const int) const;
bool operator==(const float) const;
bool operator==(const double) const;
bool operator==(const Fraction&) const;
bool operator!=(const int) const;
bool operator!=(const float) const;
bool operator!=(const double) const;
bool operator!=(const Fraction&) const;
Fraction& operator+(const int) const;
Fraction& operator+(const Fraction&) const;
Fraction& operator+=(const int);
Fraction& operator+=(const Fraction&);
Fraction& operator-(const int) const;
Fraction& operator-(const Fraction&) const;
Fraction& operator-=(const int);
Fraction& operator-=(const Fraction&);
Fraction& operator*(const int) const;
Fraction& operator*(const Fraction&) const;
Fraction& operator*=(const int);
Fraction& operator*=(const Fraction&);
Fraction& operator/(const int) const;
Fraction& operator/(const Fraction&) const;
Fraction& operator/=(const int);
Fraction& operator/=(const Fraction&);
};
}