::: Zany's Homepage ::: Zany Wiki | »çÀÌÆ® ÅëÇÕ °Ë»ö
 
 
 

[C++] Format number with commas?

°Ô½ÃÆÇ
C/C++ Basics
ÀÛ¼ºÀÚ
helix
ÀÛ¼ºÀÏ
2013-02-01 13:43:13
ÀÐÀº¼ö
3704
ÆòÁ¡
   
Ç¥½Ã¿É¼Ç
HTML»ç¿ë | ÀÚµ¿BRűנ| °ø¹é¹®ÀÚÇã¿ë | °¡¿îµ¥Á¤·Ä | °íÁ¤Æø±Û²Ã | ÀÚµ¿URL¸µÅ© | ¸¶¿ì½º¼±ÅÃ
°ü·Ã¸µÅ©01
http://stackoverflow.com/questions/7276826/c-format-number-with-commas 
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:



 °Ô½ÃÆÇ ±Û ¸ñ·Ï
No Subject Poster Hits Posted
4166 helix 2678 2013-03-26 16:30:25
helix 3704 2013-02-01 13:43:13
4072 helix 2437 2013-01-21 20:16:22
1569 helix 3927 2007-04-19 00:34:25
708 slipknot 4405 2006-02-04 11:55:45
707 slipknot 3832 2006-02-04 11:55:29
706 slipknot 9300 2006-02-04 11:55:13
ÄÚ¸àÆ®
ÀÛ¼ºÀÚ
                       
 
zany.kr
  Copyright ¨Ï 2002-2010 Zany's Programming Lab. All Rights Not Reserved.
temporary This Page loads on 0.016 Secs