Advertisement
Sanlover

Untitled

Dec 28th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. Заменяешь целиком
  2. Money& operator+(Money& obj)
  3. {
  4. double summary = to_double() + obj.to_double();
  5. double left, right;
  6. right = modf(to_double() + obj.to_double(), &left);
  7. right *= 100;
  8. _a = static_cast<int>(left);
  9. _b = static_cast<int>(right);
  10.  
  11. return *this;
  12. }
  13. А это вставляешь в класс Moeny
  14. double to_double()
  15. {
  16. return double(_a + (_b / pow(10, CountNumbers(_b)) + 0.00000000001));
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement