C++ examples for Internationalization:Money
Displays the negative pattern in monetary values.
#include <iostream> #include <locale> using namespace std; int main()//from w w w. j av a 2 s . c o m { // Create a locale for US English. locale usloc("English_US"); // Set the locale of cout to US English. cout.imbue(usloc); // Get a moneypunct facet for cout. const moneypunct<char> &us_monpunct = use_facet<moneypunct<char> >(cout.getloc()); // Show the negative numeric pattern. for(int i=0; i < 4; ++i) switch(us_monpunct.neg_format().field[i]) { case money_base::none: cout << "none "; break; case money_base::value: cout << "value "; break; case money_base::space: cout << "space "; break; case money_base::symbol: cout << "symbol "; break; case money_base::sign: cout << "sign "; break; } }