Espaces de noms
Variantes
Affichages
Actions

std::put_money

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

 
 
D'entrée / sortie de bibliothèque
I / O manipulateurs
C-style I / O
Tampons
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 (obsolète)
Cours d'eau
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstractions
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
Fichier E / 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
Chaîne 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
Tableau 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 (obsolète)
ostrstream (obsolète)
strstream (obsolète)
Types
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
Interface catégorie d'erreur
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)
 
D'entrée / sortie manipulateurs
À virgule flottante en forme
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.
Formatage entier
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.
Formatage booléen
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
Largeur de champ et de contrôle de remplissage
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.
Autre mise en forme
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.
Traitement des espaces blancs
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.
Sortie de rinçage
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.
Indicateurs d'état manipulation
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.
Temps et d'argent 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)
 
Déclaré dans l'en-tête <iomanip>
template< class MoneyT >
/*unspecified*/ put_money( const MoneyT& mon, bool intl = false );
(depuis C++11)
Lorsque utilisées dans une expression out << put_money(mon, intl), convertit la valeur monétaire mon à sa représentation de caractères telle que spécifiée par la facette std::money_put de la locale courante imprégné dans 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.
Cette fonction se comporte comme une fonction de sortie formatée .
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.

Sommaire

[modifier] Paramètres

mon -
une valeur monétaire, soit long double ou 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 -
utiliser des chaînes de devises internationales si true, utilisez les symboles monétaires autrement
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.

[modifier] Retourne la valeur

Retourne un objet de type non précisé de sorte que si out est le nom d'un flux de sortie de std::basic_ostream<CharT, Traits> type, le out << put_money(mon, intl) expression se comporte comme si le code suivant est exécuté:
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);

[modifier] Exemple

#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';
}

Résultat :

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

[modifier] Voir aussi

formate une valeur monétaire pour la sortie comme une séquence de caractères
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.

(classe générique) [edit]
(C++11)
analyse une valeur monétaire
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.

(fonction générique) [edit]