共用方式為


<iomanip> put_money

Inserts a monetary amount using the desired format into a stream.

template<class Money>
    T8 put_money(
        const Money& _Amount, 
        bool _Intl
);

Parameters

  • _Amount
    The monetary amount to insert into the stream.

  • _Intl
    Set to true if manipulator should use international format, false if it should not.

Return Value

Returns str.

Remarks

The manipulator returns an object that, when inserted into the stream str, behaves as a formatted output function that calls the member function put for the locale facet money_put associated with str. If successful, the call inserts amount suitably formatted, using _Intl to indicate international format and str.fill(), as the fill element. The manipulator then returns str.

Money must be of type long double or an instantiation of basic_string with the same element and traits parameters as str.

Requirements

Header: <iomanip>

Namespace: std

See Also

Reference

<iomanip>

iostream Programming

iostreams Conventions