| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 623 人关注过本帖
标题:求助,急急急急急急急急!!!!!!
只看楼主 加入收藏
kezunhai
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-11-28
收藏
 问题点数:0 回复次数:2 
求助,急急急急急急急急!!!!!!

请各位仁兄帮我下忙
感激不尽@








设计一个程序,完成金额的大小写转换,如[size=12pt]12345.67转换为壹万贰仟叁佰肆拾伍元陆角柒分,并对大小写的数据进行格式输出。[/size]
2007-11-28 09:45
FenteLi
Rank: 1
来 自:上海
等 级:新手上路
帖 子:124
专家分:0
注 册:2007-11-24
收藏
得分:0 
private string ConvertUper(float money)
    {
        string ls_money_unit = "", ls_money, ls_unit, ls_badge = "";
        int li_long, li_i;

        ls_money = decimal.Round((decimal)money, 2).ToString("0.00");

        li_long = ls_money.Length;

        for (li_i = 1; li_i < li_long + 1; li_i++)
        {
            ls_unit = ls_money.Substring(li_long - li_i, li_i);
            ls_unit = ls_unit.Substring(0, 1);

            if (ls_unit != ".")
            {
                switch (ls_unit)
                {
                    case "0":
                        ls_unit = "零";
                        break;

                    case "1":
                        ls_unit = "壹";
                        break;

                    case "2":
                        ls_unit = "贰";
                        break;

                    case "3":
                        ls_unit = "叁";
                        break;

                    case "4":
                        ls_unit = "肆";
                        break;

                    case "5":
                        ls_unit = "伍";
                        break;

                    case "6":
                        ls_unit = "陆";
                        break;

                    case "7":
                        ls_unit = "柒";
                        break;

                    case "8":
                        ls_unit = "捌";
                        break;

                    case "9":
                        ls_unit = "玖";
                        break;

                }

                switch (li_i)
                {

                    case 1:
                        ls_badge = "分整";
                        break;

                    case 2:
                        ls_badge = "角";
                        break;

                    case 3:
                        ls_badge = "";
                        break;

                    case 4:
                        ls_badge = "元";
                        break;

                    case 5:
                        ls_badge = "拾";
                        break;

                    case 6:
                        ls_badge = "佰";
                        break;

                    case 7:
                        ls_badge = "仟";
                        break;

                    case 8:
                        ls_badge = "万";
                        break;

                    case 9:
                        ls_badge = "拾";
                        break;

                    case 10:
                        ls_badge = "佰";
                        break;

                    case 11:
                        ls_badge = "仟";
                        break;

                    case 12:
                        ls_badge = "亿";
                        break;

                    case 13:
                        ls_badge = "拾";
                        break;

                    case 14:
                        ls_badge = "佰";
                        break;

                    case 15:
                        ls_badge = "仟";
                        break;

                }

                ls_money_unit = ls_unit + ls_badge + ls_money_unit;
            }
        }

        return ls_money_unit;

    }
看看这个,合不合你胃口。
2007-11-28 11:48
kezunhai
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-11-28
收藏
得分:0 
首先谢谢你!
但你这代码还是有些特殊的情况不 能处理,
比如如果连续有几个 零的话,就都读为零,
与现实不符,
因为我认为还要增加些对于诸如零等的特殊情况的处理!
2007-11-28 20:20
快速回复:求助,急急急急急急急急!!!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016282 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved