May be the simplest digital amount Chinese uppercase function

zhaozj2021-02-11  150

/ / Enter digital amount, return to Chinese capitalization

CString tochineseCapitalMoney (Double Num) {CString Szchmoney, Sznum; INT Ilen, Inum, Iaddzero = 0;

Tchar * hzunit [18] = {_ t ("points"), _ t ("angle"), _ t ("yuan"), _ t ("pick"), _ t (""), _ t (""), _T ("10,000"), _ t (""), _ t (""), _ t ("100 million"), _ t ("pick"), _ t (""), _ t (""), _ T ("10,000"), _ t (""), _ t ("")}; tchar * hznum [10] = {_ t ("zero"), _T (""), _ t (""), _ t (""), _ t (""), _ t ("Lu"), _ t ("柒"), _ t ("柒"), _ T ("捌"), _ t ("")}; sznum.format (_T ("% 18.0f"), Num * 100); // This may have a digital error, Double only 15 effective numbers, here only 13 sznum.trimleft (); Ilen = sznum.getLength ();

IF (Ilen> 15 || Ilen == 0 || Num <0) Return ""; // Data Error Return

For (int i = 0; i 0) szchmoney = _T ("zero"); szchmoney = hznum [inum]; Iaddzero = 0;} if (inum! = 0 || Ilen-i == 3 || Ilen-i == 11 | ((ilen-i 1 )% 8 == 0 && Iaddzero <4)) // This bit is not 0 || 元 | || | 位 || 万 位 Szchmoney = Hzunit [Ilen-I-1];}

IF (sznum.right (2) == _ t ("00")) SZCHMONEY = _ T ("whole"); Return Szchmoney;}

转载请注明原文地址:https://www.9cbs.com/read-6027.html

New Post(0)