moneypunct::neg_format

傳回格式化輸出的一個地區設定專用規則加上負值的數量。

pattern neg_format( ) const;

傳回值

格式化輸出中的一個地區設定專用規則加上負值的數量。

備註

成員函式傳回 do_neg_format

範例

// moneypunct_neg_format.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>

using namespace std;

int main( ) {
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct = 
      use_facet <moneypunct <char, true > >(loc);
   cout << loc.name( ) << " international negative number format: "
        << mpunct.neg_format( ).field[0] 
        << mpunct.neg_format( ).field[1] 
        << mpunct.neg_format( ).field[2] 
        << mpunct.neg_format( ).field[3] << endl;

   const moneypunct <char, false> &mpunct2 = 
      use_facet <moneypunct <char, false> >(loc);
   cout << loc.name( ) << " domestic negative number format: "
        << mpunct2.neg_format( ).field[0] 
        << mpunct2.neg_format( ).field[1] 
        << mpunct2.neg_format( ).field[2] 
        << mpunct2.neg_format( ).field[3] << endl;
}

範例輸出

German_Germany.1252 international negative number format: $+vx
German_Germany.1252 domestic negative number format: +v $

需求

標題: <locale>

命名空間: std

請參閱

參考

moneypunct Class