Espaços nominais
Variantes
Acções

std::put_money

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

 
 
De entrada / saída da biblioteca
I / O manipuladores
C estilo de 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.
(obsoleta)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstrações
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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.
Cordas 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.
Matriz de 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.
(obsoleta)
(obsoleta)
(obsoleta)
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.
Interface de categoria de erro
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.
(C++11)
 
Entrada / saída manipuladores
De ponto flutuante de formatação
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.
Formatação inteiro
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.
Formatação booleana
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.
Largura do campo e controle de preenchimento
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.
Outra formatação
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.
Espaços de processamento
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.
Saída de descarga
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.
Sinalizadores de status manipulação
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.
Tempo e dinheiro 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.
(C++11)
(C++11)
put_money
(C++11)
(C++11)
 
Definido no cabeçalho <iomanip>
template<class MoneyT >
/*unspecified*/ put_money(const MoneyT& mon, bool intl =false);
(desde C++11)
Quando utilizado num out << put_money(mon, intl) expressão, converte o valor monetário mon a sua representação de caracteres, tal como especificado pelo std::money_put faceta da localidade actualmente impregnada em 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 função se comporta como uma função de saída formatada.
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.

Índice

[editar]Parâmetros

mon -
um valor monetário, ou longdouble ou basic_string
Original:
a monetary value, either longdouble 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 -
usar cordas monetários internacionais se true, use símbolos de moeda de outro modo
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

Devolve um objecto de tipo não especificado de tal forma que se out é o nome de um fluxo de saída de std::basic_ostream<CharT, Traits> tipo, então a expressão out << put_money(mon, intl) se comporta como se o seguinte código foi executado:
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.

typedefstd::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]Exemplo

#include <iostream>#include <iomanip>int main(){longdouble 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';}

Saída:

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

[editar]Veja também

formatos de valor monetário para a saída como uma seqüência 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.

(modelo de classe)[edit]
(C++11)
analisa um valor monetário
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.

(modelo de função)[edit]
close