Espacios de nombres
Variantes
Acciones

std::put_money

De cppreference.com
< cpp‎ | io‎ | manip

 
 
Entrada / salida de la biblioteca
I / O manipuladores
C-estilo I / O
Buffers
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(obsoleto)
Arroyos
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstracciones
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
File I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
Cadena de I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Matriz I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(obsoleto)
ostrstream(obsoleto)
strstream(obsoleto)
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Error interfaz categoría
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
Entrada / salida manipuladores
De punto flotante de formato
Original:
Floating-point formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formato Integer
Original:
Integer formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formato booleano
Original:
Boolean formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
boolalpha
noboolalpha
Ancho de campo y de control de llenado
Original:
Field width and fill control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Otros formatos
Original:
Other formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Los espacios en blanco de procesamiento
Original:
Whitespace processing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Salida de lavado
Original:
Output flushing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Indicadores de estado manipulación
Original:
Status flags manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tiempo y dinero I / O
Original:
Time and money I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
get_money(C++11)
get_time(C++11)
put_money(C++11)
put_time(C++11)
 
Defined in header <iomanip>
template< class MoneyT >
/*unspecified*/ put_money( const MoneyT& mon, bool intl = false );
(desde C++11)
Cuando se utiliza en un out << put_money(mon, intl) expresión, convierte el valor monetario mon a su representación de caracteres especificados por la faceta std::money_put de la configuración regional actualmente imbuido en out .
Original:
When used in an expression out << put_money(mon, intl), converts the monetary value mon to its character representation as specified by the std::money_put facet of the locale currently imbued in out.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Esta función se comporta como una función de la salida con formato .
Original:
This function behaves as a formatted output function.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Parámetros

mon -
un valor monetario, ya sea long double o basic_string
Original:
a monetary value, either long double or basic_string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
intl -
utilizar cadenas internacionales de divisas si true, utilice los símbolos de moneda lo contrario
Original:
use international currency strings if true, use currency symbols otherwise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

Devuelve un objeto de tipo no especificado de tal manera que si out es el nombre de un flujo de salida de std::basic_ostream<CharT, Traits> tipo, entonces la expresión out << put_money(mon, intl) comporta como si el código se ha ejecutado:
Original:
Returns an object of unspecified type such that if out is the name of an output stream of type std::basic_ostream<CharT, Traits>, then the expression out << put_money(mon, intl) behaves as if the following code was executed:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

typedef std::ostreambuf_iterator<CharT, Traits> Iter;
typedef std::money_put<CharT, Iter> MoneyPut;
const MoneyPut& mp = std::use_facet<MoneyPut>(out.getloc());
const Iter end = mp.put(Iter(out.rdbuf()), intl, out, out.fill(), mon);
if (end.failed())
    out.setstate(std::ios::badbit);

[editar] Ejemplo

#include <iostream>
#include <iomanip>
int main()
{
    long double mon = 123.45; // or std::string mon = "123.45";
    std::cout.imbue(std::locale("en_US.utf8"));
    std::cout << std::showbase
              << "en_US: " << std::put_money(mon) << " or " << std::put_money(mon, true) << '\n';
    std::cout.imbue(std::locale("ru_RU.utf8"));
    std::cout << "ru_RU: " << std::put_money(mon) << " or " << std::put_money(mon, true) << '\n';
    std::cout.imbue(std::locale("ja_JP.utf8"));
    std::cout << "ja_JP: " << std::put_money(mon) << " or " << std::put_money(mon, true) << '\n';
}

Output:

en_US: $1.23 or USD  1.23
ru_RU: 1.23 руб or 1.23 RUB 
ja_JP: ¥123 or JPY  123

[editar] Ver también

formatos de un valor monetario para la salida como una secuencia de caracteres
Original:
formats a monetary value for output as a character sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(clase de plantilla) [edit]
(C++11)
analiza un valor monetario
Original:
parses a monetary value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla) [edit]