Mega Code Archive

 
Categories / C++ Tutorial / Development
 

Use a German locale to write data to standard ouput

/* The following code example is taken from the book  * "The C++ Standard Library - A Tutorial and Reference"  * by Nicolai M. Josuttis, Addison-Wesley, 1999  *  * (C) Copyright Nicolai M. Josuttis 1999.  * Permission to copy, use, modify, sell and distribute this software  * is granted provided this copyright notice appears in all copies.  * This software is provided "as is" without express or implied  * warranty, and with no claim as to its suitability for any purpose.  */ #include <iostream> #include <locale> using namespace std; int main() {     // use classic C locale to read data from standard input     cin.imbue(locale::classic());     // use a German locale to write data to standard ouput     cout.imbue(locale("de_DE"));     // read and output floating-point values in a loop     double value;     while (cin >> value) {         cout << value << endl;     } } This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.