| | |
| | | return res;
|
| | | }
|
| | |
|
| | | CString & intToString(int num, int digit)
|
| | | CString intToString(int num, int digit)
|
| | | {
|
| | | static CString Str1;
|
| | | if (digit != 0) {
|
| | |
| | |
|
| | | return Str1;
|
| | | }
|
| | | CString fixToString(int num, int digit, int fracdigit)
|
| | | {
|
| | | static CString Str1;
|
| | | if (digit != 0) {
|
| | | CString str2;
|
| | | str2.Format(_T("%%%dd"), digit);
|
| | | Str1.Format(str2, num);
|
| | |
|
| | | }
|
| | | else {
|
| | | Str1.Format(_T("%d"), num);
|
| | | }
|
| | |
|
| | | int k = Str1.GetLength();
|
| | | int j = (k - 1 - fracdigit) / 3; //逗号个数
|
| | | int l = k - fracdigit - j * 3; //起始位置
|
| | | for (int i = l; i < k -fracdigit + j; i += 4)
|
| | | {
|
| | | Str1.Insert(i, _T(","));
|
| | | }
|
| | | if (fracdigit>0) Str1.Insert(k - fracdigit + j, '.');
|
| | | return Str1;
|
| | | }
|
| | | CString & intToBinString(int num, int digits)
|
| | | {
|
| | | static CString Str1;
|