#include #include #include #include #include //for runtime_error using namespace std; void print(); int main() { const locale save = cout.getloc(); //save cout's locale print(); try { cout.imbue(locale("fr_CA")); } catch (const runtime_error& e) { cerr << e.what() << "\n"; } print(); cout.imbue(save); //return to saved locale print(); return EXIT_SUCCESS; } void print() { cout << "Locale \"" << cout.getloc().name() << "\":\n" << "integer: " << 123456789 << "\n" << "double: " << fixed << setprecision(3) << 123456789.123 << "\n\n"; }