【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写

分类: 小知识

【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写

【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写

话题:123456789大写,兴趣爱好

如何把:会计上的金额:123456789.321转换成中文大写和英文.??
壹亿贰仟叁佰肆拾伍万陆仟柒佰捌拾玖圆叁角贰分壹厘.
和相应的英文写法???????????
只要你努力,总会成功的!
StringUpperMoney(doublejn)
{
intL,ZL,Z,U,V;
AnsiStringF="壹贰叁肆伍陆柒捌玖";
AnsiStringG="元万亿万拾佰仟分角";
AnsiStringAA,B,JNS;
JNS.SetLength(255);
doubleje;
if(jn0;)
{
Z=StrToInt(JNS.SubString(ZL-L,1));
U=int(L/4);
V=L%4;
if(Z>0)
{
U=(V==0?U+U-1:V+V+(U>0?7:13));
AA=AA+B+F.SubString(Z+Z-1,2)+G.SubString(U,2);
B="";
}
else
{
if(L==1)
AA=AA+"整";
else
{
if(V==0)
AA=AA+G.SubString(U*2-1,2);
else
AA=AA+"";
}
B=(V>=0?"零":"");
}
L=(L==4?2:L-1);
}
returnAA;
}
服了你了.发了这么多贴子
我跟着你接分好了.你结了贴分数也不会少的.
记得头文件是
#include
staticchar*pszBIG5[]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
staticchar*pszUNITS[]={"分","角","拾","佰","仟","万"};
staticchar*pszAdvaUNITS[]={"万","亿"};
//实际字符数组位置
#defineBIG5_POS(n)(n-'0')
//转换10000以内的数字为大写
CStringToBIG5(UINTnValue)
{
ASSERT(nValue=0;i--)
{
chCur=strValue.GetAt(i);
CStringstrTmp=pszBIG5[BIG5_POS(chCur)];
cInteger++;
if(chCur!='0')
{
if(2==cInteger)
{
strTmp+=pszUNITS[2];
}
elseif(3==cInteger)
{
strTmp+=pszUNITS[3];
}
elseif(4==cInteger)
{
strTmp+=pszUNITS[4];
}
}
strRet=strTmp+strRet;
}
//
intnPos=0;
intnPriorPos=0;
boolbStartup=false;
nPos=strRet.Find(pszBIG5[0],0);
do
{
//strRet.TrimRight(pszBIG5[0]);
//strRet.TrimLeft(pszBIG5[0]);
if(strRet.Right(2)==pszBIG5[0])
{
strRet.Delete(strRet.GetLength()-2,2);
}
nPriorPos=strRet.Find(pszBIG5[0],nPos+2);
if(-1==nPriorPos)
{
break;
}
if(2==(nPriorPos-nPos))
{
strRet.Delete(nPos,2);
}
}while((nPos=strRet.Find(pszBIG5[0]),nPos+2)!=-1);
if(strRet.Left(2)==pszBIG5[0])
{
strRet.Delete(0,2);
}
returnstrRet;
}
/*
*将阿拉伯数字转换为大写方式
*/
CStringDoubleToBIG5(doubledValue)
{
CStringstrRet;
CStringstrTemp,strFloat,strInteger;
BOOLbFloat=TRUE;
strTemp.Format("%.2f",dValue);
intnLen=strTemp.GetLength();
inti=strTemp.Find('.');
intcInteger=0;
charchCur,chPrior;
//转换小数点为大写
chCur=strTemp.GetAt(i+1);
chPrior=strTemp.GetAt(i+2);
if('0'==chCur)
{
strFloat=pszBIG5[0];
if(chPrior>'0')
{
strFloat+=pszBIG5[BIG5_POS(chPrior)];
strFloat+=pszUNITS[0];
}
else
{
strFloat="";
bFloat=FALSE;
}
}
else
{
strFloat=pszBIG5[BIG5_POS(chCur)];
strFloat+=pszUNITS[1];
if(chPrior>'0')
{
strFloat+=pszBIG5[BIG5_POS(chPrior)];
strFloat+=pszUNITS[0];
}
}
//转换整数部分为大写
strInteger="";
strTemp.Format("%u",(UINT)dValue);
intcRealLen=nLen-3;
intcSegments=(cRealLen)/4;
if((cRealLen%4)>0)
{
cSegments++;
}
for(i=1;i4)
{
strTemp.Delete(strTemp.GetLength()-4,4);
}
if(i>=2)
{
strInteger=ToBIG5(atol((LPCSTR)strSwap))+pszAdvaUNITS[i-2]+strInteger;
}
else
{
strInteger=ToBIG5(atol((LPCSTR)strSwap))+strInteger;
}
}
if(""==strFloat)
{
if(""==strInteger)
{
strRet=pszBIG5[0];
strRet+="圆整";
}
else
{
strRet=strInteger+"圆整";
}
}
else
{
strRet=strInteger+"圆"+strFloat;
}
/*
if(strRet!=""&&strRet!=pszBIG5[0])
{
if(strRet.Left(2)==pszBIG5[0])
{
strRet.Delete(0,2);
}
}
//*/
strRet="人民币"+strRet;
returnstrRet;
}
我以前写的一个!!!!
现在的人可真懒呀!!
实话说,不是我写的:
#include
voidmain()
{
doublex,y;
char*ch[]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
char*ch1[]={"拾","佰","仟","万","拾","佰","仟","亿"};
charnum[256];
longi,n,j,m,y1;
printf("input:");
scanf("%lf",&x);
n=(long)x;/*得整数部分*/
y=x-n;/*得小数部分*/
for(i=0;n!=0;i++)
{
num[i]=(char)(n%10);
n/=10;
}
m=i;
num[i]='.';
for(y=y*10;(long)((y-(long)y)*10);)/*如果小数位还是有数(非0)循环继续*/
y*=10;/*小数转化为整数如0.11111转为11111.00...*/
y1=(long)y;
for(i=m+1;y1!=0;i++)
{num[i]=(char)(y1%10);
y1=y1/10;}/*取各位上的数字*/
for(n=0;;n++)
{
if(num[n]=='.')
{
for(j=n-1;j>=0;j--)/*判断是否是万位,亿位..如是再判断是否是0如是就不输出零.*/
{
if(m=2)
{printf("%s",ch1[m-2]);/*输出拾佰仟..如有2位就输出拾*/
m=m--;}
}
printf("点");
break;
}
}
for(i=i-1;num[i]!='.';i--)
printf("%s",ch[(int)num[i]]);/*输出小数部分*/
}

我也懒
最简单的方法:
char*c1[]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
char*c2[]={"亿","仟","佰","拾","万","仟","佰","拾","圆","角","分","厘"};
charc[100],china[100];
doubled=123456789.321;
sprintf(c,"%.3f",d);
inti,j,k,len=strlen(c);
//find'.'
for(j=0;j9)//>亿
return;
j=9-j;
break;
}
}
china[0]='\0';
for(i=0,k=0;i<len-1;i++){
if(c[i]=='.')
k++;
strcat(china,c1[c[k++]-0x30]);
strcat(china,c2[i+j]);
}
//china="壹亿贰仟叁佰肆拾伍万陆仟柒佰捌拾玖圆叁角贰分壹厘".
meCAD(狂学C++中,宣告彻底失恋)跟的真紧啊。
可惜没有英文转换。

分享:有长相没对象 > 【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??

--免责声明-- 《【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写》是一篇非常优秀的文章,文笔优美俱佳,如果《【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写》这篇文章结尾注明了由本站原创,那么《【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写》版权就属于本站,如果没有注明那么《【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写》这篇文章则转载于网络,或者由本站会员发表,版权归原作者,只代表作者观点和本站无关,如果您认为《【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写》这篇文章侵犯了您的权益,请联系我们删除,我们会在看到第一时间删除《【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写》这篇文章828la6787。

【结语】:【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写(全文完),小编在下方为大家整理了更多好看的相关文章,希望大家能够喜欢。
【温馨提示】:早睡早起,按时吃饭,多运动,每天开心学习和工作,做个健康的正能量人士。

更多【【123456789大写】如何把:会计上的金额:123456789.321转换成中文大写和英文.??_123456789大写】推荐文章

<small id='828la6787'></small><noframes id='828la6787'>

  • <tfoot id='828la6787'></tfoot>

      <legend id='828la6787'><style id='828la6787'><dir id='828la6787'><q id='828la6787'></q></dir></style></legend>
      <i id='828la6787'><tr id='828la6787'><dt id='828la6787'><q id='828la6787'><span id='828la6787'><th id='828la6787'></th></span></q></dt></tr></i><div id='828la6787'><tfoot id='828la6787'></tfoot><dl id='828la6787'><fieldset id='828la6787'></fieldset></dl></div>
          <bdo id='828la6787'></bdo><ul id='828la6787'></ul>