public member function
std::numpunct::decimal_point
<locale>
char_type decimal_point() const;
Return decimal point character
Returns the character used to represent the decimal radix separator.
For the standard specialization of
char the function returns
'.'.
For the standard specialization of
wchar_t the function returns
L'.'.
During its operation, the version of this function in the generic template simply calls the virtual protected member
do_decimal_point, which is the member function in charge of performing the actions described above.
Parameters
none
Return value
The character used as decimal separator.
char_type is a member alias of the template parameter
charT (i.e., the facet's character type).
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
// numpunct::decimal_point example
#include <iostream>
#include <locale>
using namespace std;
int main ()
{
int nUnits=11;
int nQuarters=7;
char point = use_facet<numpunct<char> >(cout.getloc()).decimal_point ();
cout << nUnits << " units and " << nQuarters << " quarters total ";
cout << (nUnits+nQuarters/4) << point << (25*(nQuarters%4)) << endl;
return 0;
}
|
Output:
11 units and 7 quarters total 12.75
|
See also
- numpunct::thousands_sep
- Return thousands separator character (public member function)
- moneypunct::decimal_point
- Return decimal point character (public member function)