二叉树第6个节点下面有几个节点OR-MAING的几种用法,具体用ASP。NET中,用户输入1234567.01234转换为大写的壹贰叁肆伍陆柒。零壹贰叁肆,而且,允许正负可达亿位,并且不可出错(用C#的语言来实现)

解决方案 »

  1.   

    GOOGLE或BAIDU
    这里不应该是伸手就能获得知识的。
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.Text;namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                string show_Str = ""; 
                string Str = "1234567.01234";
                string[] Arr = Str.Split('.');
                
                int Str_dawei=Arr[0].Length;            for (int i = 0; i < Arr[0].Length; i++) 
                {
                    show_Str += Program.shuzi(int.Parse(Arr[0].Substring(i,1))) + Program.danwei(Str_dawei);
                    Str_dawei = Str_dawei - 1;
                }
                if (Str.IndexOf('.') > -1) 
                {
                    show_Str += "点";
                    for (int j = 0; j < Arr[1].Length; j++) 
                    {
                        show_Str += Program.shuzi(int.Parse(Arr[1].Substring(j, 1)));
                    }            }            System.Console.Write(show_Str);
                System.Console.ReadLine();
            }
            public static string danwei(int Str_Length) 
            {
                string Re_Str="";
                switch (Str_Length)
                {
                    case 1:
                        Re_Str= "";
                        break;
                    case 2:
                        Re_Str=  "十";
                        break;
                    case 3:
                        Re_Str= "百";
                        break;
                    case 4:
                       Re_Str= "千";
                        break;
                    case 5:
                        Re_Str=  "万";
                        break;
                    case 6:
                        Re_Str=  "十";
                        break;
                    case 7:
                        Re_Str= "百";
                        break;
                    case 8:
                        Re_Str= "千";
                        break;
                    case 9:
                       Re_Str= "亿";
                        break;
                    default:
                        Re_Str = "";
                        break;
                  
                       
                }
                return Re_Str;
            }
            public static string shuzi(int Str_shuzi)
            {
                string Re_Str = "";
                switch (Str_shuzi)
                {
                    case 0:
                        Re_Str = "零";
                        break;
                    case 1:
                        Re_Str = "壹";
                        break;
                    case 2:
                        Re_Str = "贰";
                        break;
                    case 3:
                        Re_Str = "叁";
                        break;
                    case 4:
                        Re_Str = "肆";
                        break;
                    case 5:
                        Re_Str = "伍";
                        break;
                    case 6:
                        Re_Str = "陸";
                        break;
                    case 7:
                        Re_Str = "柒";
                        break;
                    case 8:
                        Re_Str = "捌";
                        break;
                    case 9:
                        Re_Str = "玖";
                        break;
                    default:
                        Re_Str = "";
                        break;
                   
                }
                return Re_Str;
                
            }
        }
    }
      

  3.   


    string nums = "1234567.01234";
            string Nums = "零壹贰叁肆伍陆柒捌玖";
            StringBuilder newnums = new StringBuilder("");
            foreach (char s in nums)
            {
                if (s != '.' && s != '-')
                {
                    newnums.Append(Nums[int.Parse(s.ToString())]);
                }
                else
                {
                    newnums.Append(s);
                }
            }
    期待更好的,应该是尽量减少程序复杂度。