2018-03-09 09:47:53 +01:00
|
|
|
// file: RationalNumber.cpp
|
|
|
|
#include "RationalNumber.hpp"
|
|
|
|
|
|
|
|
RationalNumber addRationalNumbers(RationalNumber left, RationalNumber right){
|
2018-06-18 19:00:00 +02:00
|
|
|
RationalNumber result = left;
|
2018-03-09 09:47:53 +01:00
|
|
|
// add left and right
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
RationalNumber operator+ (RationalNumber left, RationalNumber right){
|
|
|
|
return addRationalNumbers(left, right);
|
|
|
|
}
|
|
|
|
|
|
|
|
// for println()
|
|
|
|
std::string as_string(RationalNumber r){
|
|
|
|
std::string result = "(";
|
|
|
|
result += std::to_string(r.zaehler);
|
|
|
|
result += "/";
|
|
|
|
result += std::to_string(r.nenner);
|
|
|
|
result += ")";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*std::ostream& operator<< (std::ostream& os, RationalNumber &toBePrinted){
|
|
|
|
os << "(" << toBePrinted.zaehler << "/"
|
|
|
|
<< toBePrinted.nenner << ")";
|
|
|
|
return os;
|
|
|
|
}*/
|