用JAVA做个人民币大小写转换器
import java.awt.*; import javax.swing.*; import java.awt.event.*; public class GUI extends JPanel{ private JTextField inTextField=new JTextField(20); private JTextField outTextField=new JTextField(50); private Timer timer=new Timer(100,new TimerListener()); private Changer changer=new Changer();//转换器// public GUI(){ JPanel p1=new JPanel(); p1.add(new JLabel(“小写”)); p1.add(inTextField); p1.add(new JLabel(“大写”)); p1.add(outTextField); setLayout(new BorderLayout()); add(p1,BorderLayout.CENTER); outTextField.setEditable(false); inTextField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ timer.stop(); changer.setIn(inTextField.getText()); outTextField.setText(changer.change()); timer.start(); } }); timer.start(); } class TimerListener implements ActionListener{ public void actionPerformed(ActionEvent e){ if(!inTextField.getText().equals(“”)){ changer.setIn(inTextField.getText()); outTextField.setText(changer.change()); } } } public static void main(String[] args){ JFrame frame=new JFrame(); GUI gui=new GUI(); frame.getContentPane().add(gui); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); } static class Changer{ String in; String out=””; public Changer(){ } public Changer(String in){ this.in=in; } public void setIn(String in){ this.in=in; } public String change(){ int lengthOfP1=(in.indexOf(“.”)!=-1) ? in.indexOf(“.”) : in.length(); //整数部分//; int lengthOfP2=(in.indexOf(“.”)!=-1) ? in.length()-lengthOfP1-1 : in.length()-lengthOfP1 ; //小数部分//; if(lengthOfP2>2){ in=in.substring(0,in.indexOf(“.”)+3); } //取两位小数// int p1=0; int p2=0; if(in.indexOf(“.”)!=-1&&in.indexOf(“.”)!=in.length()-1){ p1=I
excel金额大小写自动转换
=IF(M13<0,”金额为负无效”,IF((M13=0),”零元整”,IF(M13<1,””,TEXT(INT(M13),”[dbnum2]G/通用格式”&”元”)&IF(INT(M13*10)-INT(M13)*10=0,””,””))&IF(AND((INT(M13*100)-INT(M13*10)*10)<>0,(INT(M13*10)-INT(M13)*10)=0),”零”,IF((INT(M13*10)-INT(M13)*10)=0,””,TEXT(INT(M13*10)-INT(M13)*10,”[dbnum2]G/通用格式”&”角”)))&IF((INT(M13*100)-INT(M13*10)*10)=0,”整”,TEXT(INT(M13*100)-INT(M13*10)*10,”[dbnum2]G/通用格式”&”分”))))
参照上述公式吧,上面的公式是把M13单元格的金额自动转换为人民币大写金额!
人民币大小写转换c++程序
#include <iostream.h>
#include <math.h>
void main()
{ double x,i=10000000;
int j=0;
unsigned int quotient,remainder;
bool beginFlag=0,zeroFlag=0;
cout<<“请输入预转换数额(小于1亿):”;
cin>>x;
while (x>=100000000 )
{
if (j>=2)
{
cout<<“你的错误输入已达3次,你无权再输入!”<<endl;
return;
}
cout<<“你输入的金额超出转换范围,请重新输入!”<<endl;
cout<<“请输入预转换数额(小于1亿):”;
cin>>x;
j++;
}
if (x<=0)
{
cout<<“零元整”<<endl;
return;
} x=floor(x*100 +0.5)/100; //小数点后2位四舍五入
while (i>0.001)
{
if (i>0.9)
quotient=(unsigned int)floor(x/i);
else
{
if (i>=0.099)
quotient=(unsigned int)floor(x*10);
else
quotient=(unsigned int)floor(x*100);
}
remainder=quotient%10;
if (remainder!=0)
beginFlag=1;
if ((zeroFlag==1) && (beginFlag==1) && (i>1000) && (remainder>0))
cout<<“零”;
switch (remainder) //输出大写数字
{
case 0:
break;
case 1:
cout<<“壹”;
break;
case 2:
cout<<“贰”;
break;
case 3:
cout<<“叁”;
break;
case 4:
cout<<“肆”;
break;
case 5:
cout<<“伍”;
break;
case 6:
cout<<“陆”;
break;
case 7:
cout<<“柒”;
break;
case 8:
cout<<“捌”;
break;
case 9:
cout<<“玖”;
break;
}
if (remainder>0)
zeroFlag=0;
else if (beginFlag==1)
zeroFlag=1;
if (beginFlag==1) //输出单位
{
if ((i==10000000) && (remainder>0))
cout<<“仟”;
if ((i==1000000) && (remainder>0))
cout<<“百”;
if ((i==100000) && (remainder>0))
cout<<“十”;
if (i==10000)
cout<<“万”;
if ((i==1000) && (remainder>0))
cout<<“仟”;
if ((i==100) && (remainder>0))
cout<<“百”;
if ((i==10) && (remainder>0))
cout<<“十”;
if (i==1)
cout<<“元”;
if ((i>=0.09) && (i<1) && (remainder>0))
cout<<“角”;
if ((i>=0.009) && (i<0.1) && (remainder>0))
cout<<“分”;
}
i=i/10;
}
cout<<“整”<<endl;
}
急需大小写数字转换器,以及个人所得税计算器,供没网络的时候也可以用.
大小写转换用紫光输入法,输入大写字母I,后跟数字就可以转换了. 个人所得税计算器去搞张速算扣除数表就可以了.
小写金额自动生成大写金额
可 以用以下这个公式: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(IF(-RMB(A1,2),TEXT(A1,";负")&TEXT(INT(ABS(A1)+0.5%),"[dbnum2]G/通用格式元;;")&TEXT(RIGHT(RMB(A1,2),2),"[dbnum2]0角0分;;整"),),"零角",IF(A1^2<1,,"零")),"万",IF(AND(MOD(ABS(A1%),1000)<100,MOD(ABS(A1%),1000)>=10),"万零","万")),"零分","整")
大小写金额转换
int a =金额 int b2 (百分位),b1 (十分位),b0 (个位) b2=a/100 ("/"运算是取整) b1=a%100 ( %运算是取余) c1=b1%10 (这样就取得了个位) b1=b1/10 (最后取得十位数字) 就这种思路 当然你format转化为string然后按位读取也是可以的
金额小写转换成大写
word中没有直接转换功能,只能直接输入
execl中,小写金额转换成大写金额,如A1中输入123.56元,B1中转换成(人民币 壹佰贰拾叁圆伍角陆分)
建议你把A1中的元去掉,然后右击鼠标修改A1单元格的格式为“自定义“,格式是(#“元“)
B1=”(人民币 “&IF((INT(A1*10)-INT(A1)*10)=0,TEXT(INT(A1),”[DBNum2]G/通用格式”)&”元”&IF((INT(A1*100)-INT((A1)*10)*10)=0,”整”,”零”&TEXT(INT(A1*100)-INT(A1*10)*10,”[DBNum2]G/通用格式”)&”分”),TEXT(INT(A1),”[DBNum2]G/通用格式”)&”元”&IF((INT((A1)*100)-INT((A1)*10)*10)=0,TEXT((INT(A1*10)-INT(A1)*10),”[DBNum2]G/通用格式”)&”角整”,TEXT((INT(A1*10)-INT(A1)*10),”[DBNum2]G/通用格式”)&”角”&TEXT(INT(A1*100)-INT(A1*10)*10,”[DBNum2]G/通用格式”)&”分”)) &”)”
如果还不懂,请联络QQ:3499149
excel人民币大写转换
假设小写金额在F2 则大写金额公式为=text(int(F2),"[dbnum2]")&"圆"&text(–right(F2*100,2),"[dbnum2]0角0分")
vb实现金额大小写转换
拆散,逐个转换,然后组合. Private Sub Command1_Click() s = "hfgJUYGjHU" Print s s1 = "" For i = 1 To Len(s) ch = Mid(s, i, 1) If ch >= "a" And ch <= "z" Then s1 = s1 + UCase(ch) ElseIf ch >= "A" And ch <= "Z" Then s1 = s1 + LCase(ch) End If Next i Print s1 End Sub