求助! 二叉树第6个节点下面有几个节点OR-MAING的几种用法,具体用ASP。NET中,用户输入1234567.01234转换为大写的壹贰叁肆伍陆柒。零壹贰叁肆,而且,允许正负可达亿位,并且不可出错(用C#的语言来实现) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 GOOGLE或BAIDU这里不应该是伸手就能获得知识的。 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; } }} 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); } }期待更好的,应该是尽量减少程序复杂度。 WebOS讨论 js 高手们,帮忙看下面的一段代码 求正则表达式~ 构建DataTable报错。。。 刚做的网页为什么打开速度很慢 图片路径问题 应该很简单的一个问题 ASP.Net自定义组件如何调试? 如何控制datagrid在编辑状态时的文框长度??? 用asp.net对XML的数据进行排序并显示 ASP.NET实现一个课程表的表格该怎么实现??? 页面设计和用户体验问题,聆听高手指导!!! 如何实现多数据库同步提交
这里不应该是伸手就能获得知识的。
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;
}
}
}
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);
}
}
期待更好的,应该是尽量减少程序复杂度。