format money correctly
This commit is contained in:
parent
fa7938ca20
commit
669a708bce
1 changed files with 6 additions and 2 deletions
|
@ -114,8 +114,12 @@ int Marketplace::getBasketSumInCent()
|
||||||
std::string Marketplace::getBasketSumAsString()
|
std::string Marketplace::getBasketSumAsString()
|
||||||
{
|
{
|
||||||
int sumInCent = getBasketSumInCent();
|
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;
|
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();
|
return sumStream.str();
|
||||||
}
|
}
|
Loading…
Reference in a new issue