template <class moneyT>/*unspecified*/ get_money (moneyT& mon, bool intl = false);
false). Then (if evaluating the sentry object is true), it calls money_get::get (using the stream's selected locale ) to perform both the extraction and the parsing operations, and adjusts the stream's internal state flags accordingly. Finally, it destroys the sentry object before returning.<iomanip> .long double or a basic_string instantiation.true for international representations, false otherwise.| flag | error |
|---|---|
| eofbit | The input sequence has no more characters available (end-of-file reached). |
| failbit | Either no characters were extracted, or the characters extracted could not be interpreted as a valid monetary value. |
| badbit | Error on stream (such as when this function catches an exception thrown by an internal operation). When set, the integrity of the stream may have been affected. |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// get_money manipulator example
#include <iostream> // std::cin, std::cout
#include <iomanip> // std::get_money
int main ()
{
long double price;
std::cout << "Please, enter the price: ";
std::cin >> std::get_money(price);
if (std::cin.fail()) std::cout << "Error reading price\n";
else std::cout << "The price entered is: " << price << '\n';
return 0;
}