From 669a708bce4dc5672ada15d99408ad513dec381c Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 24 Jul 2018 07:50:51 +0200 Subject: [PATCH] format money correctly --- src/core/marketplace.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/marketplace.cpp b/src/core/marketplace.cpp index 4f2b4af..3f87b7f 100644 --- a/src/core/marketplace.cpp +++ b/src/core/marketplace.cpp @@ -114,8 +114,12 @@ int Marketplace::getBasketSumInCent() std::string Marketplace::getBasketSumAsString() { int sumInCent = getBasketSumInCent(); - double sumInEuro = sumInCent / 100.0L; + // double sumInEuro = sumInCent / 100.0L; + // std::stringstream sumStream; + // sumStream << std::fixed << std::setprecision(2) << sumInEuro << " €"; + // return sumStream.str(); std::stringstream sumStream; - sumStream << std::fixed << std::setprecision(2) << sumInEuro << " €"; + sumStream.imbue(std::locale("de_DE.utf8")); + sumStream << std::right << std::setw(12) << std::showbase << std::put_money(sumInCent, false); return sumStream.str(); } \ No newline at end of file