From 0861409fb74c7d054098100aff8ca83aef8f2bd8 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Sun, 26 Apr 2020 14:41:41 +0200 Subject: [PATCH] Patch level : 12.0 no-patch Files correlati : Aggiunto operatore TCurrency& operator /= (const real& num); --- src/include/currency.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/include/currency.cpp b/src/include/currency.cpp index 0f460503c..b3675a3a2 100755 --- a/src/include/currency.cpp +++ b/src/include/currency.cpp @@ -427,6 +427,7 @@ TCurrency& TCurrency::operator+=(const TCurrency& cur) TCurrency TCurrency::operator+(const TCurrency& num) const { TCurrency cur(*this); + cur += num; return cur; } @@ -447,6 +448,7 @@ TCurrency& TCurrency::operator-=(const TCurrency& cur) TCurrency TCurrency::operator-(const TCurrency& num) const { TCurrency cur(*this); + cur -= num; return cur; } @@ -461,10 +463,26 @@ TCurrency& TCurrency::operator*=(const real& num) TCurrency TCurrency::operator*(const real& num) const { TCurrency cur(*this); + cur *= num; return cur; } +TCurrency& TCurrency::operator /= (const real& num) +{ + _num /= num; + _num.round(decimals()); + return *this; +} + +TCurrency TCurrency::operator / (const real& num) const +{ + TCurrency cur(*this); + + cur /= num; + return cur; +} + TCurrency TCurrency::abs() const { if (_num.sign() < 0)