GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::moneypunct::decimal_point,do_decimal_point(3) C++ Standard Libary std::moneypunct::decimal_point,do_decimal_point(3)

std::moneypunct::decimal_point,do_decimal_point - std::moneypunct::decimal_point,do_decimal_point


Defined in header <locale>
public: (1)
CharT decimal_point() const;
protected: (2)
virtual CharT do_decimal_point() const;


1) Public member function, calls the member function do_decimal_point of the most
derived class.
2) Returns the character to use as the decimal point separator in monetary I/O if
the format uses fractions (that is, if do_frac_digits() is greater than zero). For
typical U.S. locales, it is the character '.' (or L'.')


The object of type CharT holding the decimal point character.

// Run this code


#include <iostream>
#include <iomanip>
#include <locale>


void show_dpt(const char* locname)
{
std::locale loc(locname);
std::cout.imbue(loc);
std::cout << locname << " decimal point is '"
<< std::use_facet<std::moneypunct<char>>(loc).decimal_point()
<< "' for example: " << std::showbase << std::put_money(123);
if (std::use_facet<std::moneypunct<char>>(loc).frac_digits() == 0)
std::cout << " (does not use frac digits) ";


std::cout << '\n';
}


int main()
{
show_dpt("en_US.utf8");
show_dpt("ja_JP.utf8");
show_dpt("sv_SE.utf8");
show_dpt("de_DE.utf8");


}


en_US.utf8 decimal point is '.' for example: $1.23
ja_JP.utf8 decimal point is '.' for example: ¥123 (does not use frac digits)
sv_SE.utf8 decimal point is ',' for example: 1,23 kr
de_DE.utf8 decimal point is ',' for example: 1,23 €


do_frac_digits provides the number of digits to display after the decimal point
[virtual] (virtual protected member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.