数字到英文的转换
char A[19][11]={ "one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine ", "ten ", "eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen ", }; char B[9][10]= { "twenty ", "thirty ", "forty ", "fifty ", "sixty ", "seventy ", "eighty ", "ninety ", "hundred " }; CString num2char(long num ) { //int res = 0; int playh = 0; CString strValue= ""; if (!num) return "zero"; while((num || playh)) { if (num < 0) { strValue.Format("minus "); if ( num > INT_MIN ) { num = -num; } else { num = 0; } } else if (playh) { strValue+="hundred "; playh = 0; } else if (num < 20) { strValue+=A[num-1]; num = 0; } else if (num < 100) { strValue+=B[num/10-2]; num -= ((num / 10) * 10); } else { if (num < 1000){ strValue+=A[num/100-1]; playh++; num -= ((num / 100) * 100); } else { if (num < 1000000) { /* 1,000,000 */ strValue+= num2char(num / 1000); num = num % 1000; strValue+="thousand "; } else { if (num < 1000000000) { /* 1,000,000,000 */ strValue += num2char(num / 1000000); num = num % 1000000; strValue+="million "; } else { if (num < 9000000000) { /* 1,000,000,000 */ strValue += num2char(num / 1000000000); num = num % 1000000000; strValue+="billion "; } else { return ""; } } } } } } return strValue; }