1 2 3 4 5 6 7 8 9 10 11 12 13
|
// numpunct::decimal_point example
#include <iostream> // std::cout
#include <locale> // std::locale, std::numpunct, std::use_facet
int main ()
{
int nUnits=11;
int nQuarters=7;
char point = std::use_facet< std::numpunct<char> >(std::cout.getloc()).decimal_point();
std::cout << nUnits << " units and " << nQuarters << " quarters total ";
std::cout << (nUnits+nQuarters/4) << point << (25*(nQuarters%4)) << '\n';
return 0;
}
| |