2 f467060571 f467060571 于 2014.09.28 11:26 提问

怎么把阿拉伯数字变成汉字

using System;
using System.Windows.Forms;
public class MonthActualApp{
double[] rainfall;
double[] difference = new double[12];
public MonthActualApp() {
rainfall = new double[12];
for(int i=0;i<12;i++) {
System.Console.WriteLine("请输入" + (i+1) + "月的降雨量值:");
rainfall[i] = Double.Parse(System.Console.ReadLine());
}
}
public double MonthlyAverageRainfall() {
double sum = 0;
for(int i=0; i<12;i++) {
sum +=rainfall[i];
}
return sum/12;
}
public void computeDifference()
{
for (int i = 0; i < 12; i++)
{
difference[i] = rainfall[i] - MonthlyAverageRainfall();
}
}
public void printArray(double[] aArray) {
string output = "数组元素值分别为:\n";
for(int i=0; i<aArray.Length; i++){
output += aArray[i] + "\n";
}
Console.WriteLine(output);
}
public static void Main(string[] args)
{
MonthActualApp app = new MonthActualApp();
app.printArray(app.rainfall);
app.computeDifference();
app.printArray(app.difference);
string output = string.Format("{0}{1}", "月平均降雨量:",app.MonthlyAverageRainfall() + "mm") + "\n\n";
output += string.Format("{0,-5}{1,-18}{2,-18}","月", "月降雨量", "与月平均降雨量的偏差") +"\n";
for(int i=0; i<12;i++)
{
output += string.Format("{0,-8}{1,-25:n2}{2,-25:n2}",i+1,app.rainfall[i],app.difference[i]) + "\n";
}

    Console.WriteLine(output);
    Console.ReadKey();
}

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!