日期:2014-05-17  浏览次数:20903 次

跪求大神!编写C#控制台程序
编写C#控制台程序从键盘或文本框中读入若干整数,用不同的函数调用方式将它们按由低到高排序输出。
[测试数据] 
程序先输出: Please input array number: 
用户输入: 5 
程序再输出: Please input all the integers: 
用户输入: 300 700 600 450 500 
程序输出: 300 450 500 600 700
求大神!
c# 排序 函数调用

------解决方案--------------------
Array.Sort(IntArray);

------解决方案--------------------
先定义数组接收一下,
Console.WriteLine("Please input array number:");
int a = Convert.ToInt32(Console.ReadLine());
int[] number = new int[a];
for (int i = 0; i < a; i++)
{
Console.WriteLine("Please input all the integers:êo", i + 1);
int b = Convert.ToInt32(Console.ReadLine());
number[i] = b;
}
接收完以后,再对数组中的值进行排序。排序的方法网上有很多种。
我和你一样,多练习就好了。