日期:2014-05-18  浏览次数:21046 次

2012给大家拜年了,恭迎佛诞,散分发布代码
首先给论坛全体拜年了拜年了祝六亲眷属皆安乐肚大能容笑口常开!!!
-------------------------
发布代码前先声明:
1\这个代码在测试完成后就没时间去优化,如果有心人可以对代码进行优化,或转换认为更好的代码写法,这里发布仅提供参考,当然这些代码运行及运算都是正确的,因为有不同算法的双向运算可以相互印证是否运算正确,比较有信心,写好这个后老有一个想法:这个运算可以作为标准来校验其他写法运算是否正确.那么,对还是不对,有待大家测试及评论,谢谢!

2\代码写法比较随意,可以用其他写法替代,如果看不惯自己改去.

3\代码发布主要的转换部分,还要说明一点,这时我学C#WINFOMR编写仅不到3个月的代码和写法,别追问代码的意思是什么,喜欢自己动手调试和动脑的人,如果发现代码发布遗漏可以补充.
C# code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        string Zz = "零壹贰叁肆伍陆柒捌玖", Bj = "0123456789"; Double SsWr = new double(); bool PanDuan = true;
        string[] Jz = { "元", "拾", "佰", "仟" };
        string[] Jzs = { "拾", "佰", "仟" };
        string[] Zs = { "万", "亿", "兆", "京", "垓", "秭", "穰", "沟", "涧", "正", "载", "极", "恒河沙", "阿僧祇", "那由他", "不可思议", "☆无量", "☆不可说☆" };
        string[] Xs = { "角", "分", "厘","毫","丝","忽","微","纤","沙","尘","埃","渺","莫", "模糊", "逡巡","须臾","瞬息","弹指","刹那","六德","空虚","☆清静" };

        public Form1()
        {
            InitializeComponent();
        }
private void Form1_Load(object sender, EventArgs e)
        {
            ToolTip KjTs = new ToolTip();
            KjTs.SetToolTip(ZhuanHuang, "单击执行转换");
            KjTs.SetToolTip(XuanXiang, "请选择要执行小数的“四舍五入”位数");
            KjTs.SetToolTip(Kuo, "选择该项时将强行扩展整数的位数到万无量=[不可说],没有实际意义。");
        }
private void ZhuanHuang_Click(object sender, EventArgs e)
        {
            string DD_BM = SuZi.Text.Trim(); string[] Fg = new string[2];

            try
            {
                if (SuZi.Text.Length > 99 || SuZi.Text == "")
                {
                    if (SuZi.Text.Length > 99)
                        MessageBox.Show("1、操作非法,输入数值超过范围,无法计算!请重新输入小等于69位整数(强制扩展:小等于76位)和小等于22位小数!", "友情提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (SuZi.Text == "")
                        MessageBox.Show("2、操作非法!请重新输入小等于69位整数(强制扩展:小等于76位)和小等于22位小数!", "友情提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string GuoLvZiFu = DD_BM;
                    ZongWenSuZhi.Text = ""; SsWr = 0;
                    do { GuoLvZiFu = 过滤(GuoLvZiFu, false); }
                    while (PanDuan == false);//再循环
                    DD_BM = GuoLvZiFu;
                    if (ZzS.Checked)
                    {
                        do { GuoLvZiFu = 过滤(GuoLvZiFu, true); }
                        while (PanDuan == false);//再循环
                        DD_BM = GuoLvZiFu;
                        if (DD_BM.IndexOf("元") >= 0) { Fg = DD_BM.Split('元'); } //整数
                        else { Fg[0] = ""; Fg[1] = DD_BM; }//纯小数
                    }
                    if (SzZ.Checked) Fg = DD_BM.Split('.');

                    if (ZzS.Checked)//中文→数字
                    {
                        if (Fg[0] != "") //整数部分
                        {
                            if (Zhuan.Checked) ZongWenSuZhi.Text = Zh_Zwz(ZzZhengShu(Fg[0]), "中文→数字整数", true);
                            if (!Zhuan.Che