本文共 1081 字,大约阅读时间需要 3 分钟。
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace test1 { public partial class _Default : System.Web.UI.Page { protected void Page_Load( object sender, EventArgs e) { string [] NumChineseCharacter = new string [] { " 零 ", " 壹 ", " 贰 ", " 叁 ", " 肆 ", " 伍 ", " 陆 ", " 柒 ", " 捌 ", " 玖 " }; for ( double i = 1; i < 10; i++) { for ( double j = 1; j <= i; j++) { double k; k = i * j; if (k < 10) { Response.Write(NumChineseCharacter[( int )j] + NumChineseCharacter[( int )i] + " 得 " + NumChineseCharacter[( int )k] + "   "); } else { string k1,k2; k1 = k.ToString(); k2=k.ToString(); k1=k1.ToString().Substring(0, 1); //取计算结果中第一个字符 k2 = k2.ToString().Substring(1, 1); //取计算结果中第二个字符 Response.Write(NumChineseCharacter[( int )j] + NumChineseCharacter[( int )i] + NumChineseCharacter[Convert.ToUInt32(k1)] + " 拾 " + NumChineseCharacter[Convert.ToUInt32(k2)] + "   "); } } Response.Write(" <br> "); } } } } 本文转自 makewong 51CTO博客,原文链接:http://blog.51cto.com/makewong/291869,如需转载请自行联系原作者