C++ ¿¡¼ õ´ÜÀ§ ±¸ºÐ ±âÈ£°¡ Æ÷ÇÔµÈ ¼ýÀÚ·Î º¯°æÇϱâ À§ÇÑ ´äº¯.
½ºÅà ¿À¹öÇ÷ο쿡¼ »ç¿ëÀÚ°¡ äÅÃÇÑ ´äº¯º¸´Ù ±× ¹Ø¿¡ ´äº¯ÀÌ ´õ Á¤È®ÇÑ °á°ú¸¦ ³½´Ù.
»ç¿ëÀÚ°¡ äÅÃÇÑ ´äº¯Àº locale ¿¡ °ø¹é¹®ÀÚ("")°¡ ¼³Á¤µÈ imbue ¸¦ »ç¿ëÇÏ¿©
½Ã½ºÅÛ ±âº»°ª¿¡ ÀÇÁ¸ÀûÀ̱⠶§¹®¿¡ Ç×»ó õ´ÜÀ§ ±¸ºÐÀÚ°¡ »êÃâµÉ²¨¶ó°í º¸ÀåÇÏÁö ¸øÇÑ´Ù°í À̾߱â ÇÏ¸é¼ ³»³õÀº ´äº¯ÀÓ.
(±»ÀÌ C ¾ð¾î°¡ ¾Æ´Ï¶ó ´Ù¸¥ ¾ð¾î¿¡¼µµ °Þ´Â ¹®Á¦ÀÓ)
¾Æ·¡ ÄÚµå´Â ¾î¶² ½Ã½ºÅÛÀÌµç ¹«Á¶°Ç õ´ÜÀ§ ±¸ºÐ ±âÈ£¸¦ ¸¸µé¾î³½´Ù.
http://stackoverflow.com/questions/7276826/c-format-number-with-commas
You can do as Jacob suggested, and imbue with the "" locale
- but this will use the system default, which does not guarantee that you get the comma.
If you want to force the comma (regardless of the systems default locale settings)
you can do so by providing your own numpunct facet. For example:
|
|
|