共用方式為


money_put::put

將數字或字串為代表一個貨幣值的字元順序。

iter_type put(
    iter_type _Next, 
    bool _Intl, 
    ios_base& _Iosbase,
    CharType _Fill, 
    const string_type& _Val
) const;
iter_type put(
    iter_type _Next, 
    bool _Intl, 
    ios_base& _Iosbase,
    CharType _Fill,
    long double _Val 
) const;

參數

  • _Next
    解決的 Iterator 插入字串的第一個項目。

  • _Intl
    表示貨幣符號的型別必須是布林值在序列: true ,如果國際, false ,如果國家/地區內。

  • _Iosbase
    格式旗標,則集合表示貨幣符號是選擇性的;否則,需要

  • _Fill
    為間隔使用的字元。

  • _Val
    要轉換的字串物件。

傳回值

輸出 Iterator 在最後項目以外的位置一產生的位址。

備註

兩個成員函式會傳回 do_put(_Next、 _Intl、 _Iosbase、 _Fill, _Val)。

範例

// money_put_put.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
//   locale loc( "german_germany" );
   locale loc( "english_canada" );
   basic_stringstream<char> psz, psz2;
   ios_base::iostate st = 0;

   psz2.imbue( loc );
   psz2.flags( psz2.flags( )|ios_base::showbase ); // force the printing of the currency symbol
   use_facet < money_put < char > >(loc).put(basic_ostream<char>::_Iter( psz2.rdbuf( ) ), true, psz2, st, 100012);
   if (st & ios_base::failbit)
      cout << "money_put( ) FAILED" << endl;
   else
      cout << "money_put( ) = \"" << psz2.rdbuf( )->str( ) <<"\""<< endl;   

   st = 0;
};
  

需求

標題: <地區設定>

命名空間: std

請參閱

參考

money_put 類別