May 2017
Intermediate to advanced
590 pages
17h 18m
English
To write a monetary value to an output stream, you should do the following:
std::cout.imbue(std::locale("en_GB.utf8"));
long double mon = 12345.67; std::string smon = "12345.67";
std::cout << std::showbase << std::put_money(mon) << std::endl; // £123.46 std::cout << std::showbase << std::put_money(smon) << std::endl; // £123.46
Read now
Unlock full access