为了正常的体验网站,请在浏览器设置里面开启Javascript功能!
首页 > 数字换成大写

数字换成大写

2017-12-27 11页 doc 30KB 21阅读

用户头像

is_686908

暂无简介

举报
数字换成大写数字换成大写 代码如下: using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace ConvertNumber { class Program { static void Main(string[] args) { GetZWNum(Console.ReadLine()); Console.ReadLine(); } public...
数字换成大写
数字换成大写 代码如下: using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace ConvertNumber { class Program { static void Main(string[] args) { GetZWNum(Console.ReadLine()); Console.ReadLine(); } public static string GetZWNum(string strN) { string[] strNum = { "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; int bl = -1; bool ch = true; int len = strN.Length; if (len > 24) { Console.WriteLine("您输入的数字过大,无法转换~"); return ""; } string strResult = ""; string[] strSZ = new string[len]; for (int i = 0; i < len; i++) { strSZ[i] = strN.Substring(i, 1); if (!Regex.IsMatch(strSZ[i], "^[0-9]$")) { Console.WriteLine("您输入的数字含有非数字符号~"); return ""; } if (strSZ[0] == "0" && ch)//检验首位出现零的情况 { if (i != len - 1 && strSZ[i] == "0" && strSZ[i + 1] != "0") bl = i; else ch = false; } } for (int i = 0; i < len; i++) { int num = len - i; if (strSZ[i] != "0") { strResult += strNum[Convert.ToInt32(strSZ[i]) - 1];//将阿拉伯数字转换成中文大写数字 //加上单位 if (num % 4 == 2) strResult += "拾"; if (num % 4 == 3) strResult += "佰"; if (num % 4 == 0) strResult += "仟"; if (num % 4 == 1) { if (num / 4 == 1) strResult += "萬"; if (num / 4 == 2) strResult += "亿"; if (num / 4 == 3) strResult += "萬"; if (num / 4 == 4) strResult += "亿"; if (num / 4 == 5) strResult += "萬"; } } else { if (i > bl) { if ((i != len - 1 && strSZ[i + 1] != "0" && (num - 1) % 4 != 0)) { //此处判断“0”不是出现在末尾,且下一位也不是“0”; //如 10012332 在此处读法应该为壹仟零壹萬贰仟叁佰叁拾贰,两个零只要读一个零 strResult += "零"; } if (i != len - 1 && strSZ[i + 1] != "0") { switch (num) { 10002332,“0”出现在万位上就//此处出现的情况是如 应该加上一个“萬”读成壹仟萬零贰仟叁佰叁拾贰 case 5: strResult += "萬"; break; case 9: strResult += "亿"; break; case 13: strResult += "萬"; break; } } if (i != len - 1 && strSZ[i + 1] != "0" && (num - 1) % 4 == 0) { //此处出现的情况是如 10002332,“0”出现在万位上就应该加上一个“零”读成壹仟萬零贰仟叁佰叁拾贰 strResult += "零"; } } } } return strResult; } } } ? - ???? ???? ??wen???????????????????????????????????????????????? ???????????????? ????????????????????????(?)??????????--????? ??????????????????????--?????? ?????????????????--?????? (1) ?????????????????"?"???????????:??;??? (2) ??? [figure;veins] ??????:text?article??????????????????????????????????????????????????????????????????????????????"?"??????????????"?"???????????????????????????????????????????????????????"?"????????????????????? ?????????? 1???????????????????? 2.???????? 3???????????????????? 4??????????????????????????????????????????????????????a????????????b?????????? 5????????????????? 6???????????????? 7?????????????????????????? 8?????????????????? 9????????????? 10??????????????????????????? 11??????????????552???????? 12??????????? 13????????? 14???????????????? 15??? 16? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????? ????????? ?????????? ??? 1???? ??????????????????????????????????????1991?7????? ????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? 2? ??? [figure;veins] ???????????????棗???????? ???????棗??????????????????????????????????????????????? ???????棗?????? ?????棗??????? ??????????棗??????? ?????棗??????????????? 3???????????????????????????????????????????????????????????????????????????? 4???????????????????????????????????????????????????????????? [character] ?????棗????????????? ?????棗??????????? ????????棗????????? ????????????????棗?????????? ?????????棗?????????? ??????? 5??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? 6??????????????????? ??? [literary composition] ??????????棗??????? ????棗???????? ????????棗??????????? ?????棗??????????? ?????棗???????????? 7????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? 8?????? [virtue] ????????????棗????????? 9??????????????????????????????????????????????????????????????????????????????????????? 10.??????????????? [literary talent] ??????????棗??????????? 11???????????????????????????????????????????????????????????????????????????????? 12????????? [document;classics;verse] ??????棗??????? ???????????棗??????? 13??????????? [writings;record]???????????????????????????????????????????????????????????????????????????????????? 14????????? [natural phenomenon] ???????棗?????????? 15???????????????????????????????????????????????? 16??????????????? [achievements in culture and education?civilian post] ?????棗??????????? ?????? ?????棗???????????? ???????????????????????????????? 17?????????????????????????????????????????????????????????????????????????????????????????????????????????? 18????? [articles of decree] ???????????????棗???????? 19???????????????????????????????????????????????????????????????????????? 20???????????????????????? [literary language]??????????????????????? 21???????? [rites] ?????棗?????? 22??????(??????)???(?????????)???(???)???(????)??????????????(????) 23????????? [form;appearance]?????(????)???(???????)???(??) 24????????? [music;tune]?????(???)???(???) 25????????????? [study deligently] ??????棗???? ?????? 26?? ??? 1???????????? [tatto (the skin)] ?????棗???????????????????? ?????棗?????? 2???????(?????????)?????(??????????????????????????????????????????????)???(???? ???) 3?????? [cover up] ?????????棗?????????? ??????????????棗???????? 4???????????(?????)???(??????) 5??? [decorate] ?????棗?????? ????? ?????棗??????????? ??????棗??????? ????????棗??????? 6??????(????)???(???????)???(???????)???(??)???(???????)??????(??????)???(?????? )???(??????) 7????? [write]?????(??????)???(??????????)??????(???) ??? 1?????????????? [magnificent;gorgeous] ????????棗?????? ????????????棗?????????? 2??????(????)???(?????)???(?????)???(?????)???(??????)???(?????)???(?????) 3.?????? [mild;gentle]?????(?????) 4???? [fine;good]?????(??)???(?????????????)???(?????) 5??????? [disordered] ???????????????棗????? ????????????????????棗???????? ???????????????棗?????????? ??? 1?????????????? 2???????? ????????????棗?????
/
本文档为【数字换成大写】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索