Quantcast
Channel: JACKSLACK 의 블로그
Viewing all articles
Browse latest Browse all 148

숫자 천단위 콤마 처리 C++ - c++ simple Thousand seperater

$
0
0
리눅스나 POSIX 에서 로케일을 설정하여 구현하는 방법이 있으나... 윈도우, C++ 등에서는 적용이 되지않음.. 대략난감.. 리턴되는 스트링 strValueTS 를 프린트하여 해결... 코드는 참고하여 만듬... 저녁먹으러 가야겠다.. 끝.. #include std::string thousand_seperator( UINT uValue ) { std::string strValueTS; int j , i = 0, k = 0; int temp = uValue; int p = 1; while( temp > 0) //counting number of digits { temp /= 10; p *= 10; i++; } j = i % 3; p /= 10; while( i > 0 )//display integer number with 1000 seperator { strValueTS += char ((uValue/p) +'0'); uValue %= p; p /= 10; i--; k++; j--; i.......

Viewing all articles
Browse latest Browse all 148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>