6.3 客户端调用
class Program
{
static void Main(string[] args)
{
// 对整型数组排序
int[] intArray = new int[]{5, 3, 12, 8, 10};
BubbleSorter.IntBubbleSorter sorter = new BubbleSorter.IntBubbleSorter();
sorter.Sort(intArray);
foreach (int item in intArray)
{
Console.Write(item+" ");
}
Console.WriteLine("");
// 对浮点数排序
float[] floatArray = new float[] { 5.0f, 3.0f, 12.0f, 8.0f, 10.0f };
BubbleSorter.FloatBubbleSorter floatSorter = new BubbleSorter.FloatBubbleSorter();
floatSorter.Sort(floatArray);
foreach (float item in floatArray)
{
Console.Write(item + " ");
}
Console.Read();
}
}
运行结果
以上就是本文的全部内容,希望能给大家一个参考,也希望大家多多支持ASPKU。
注:相关教程知识阅读请移步到c#教程频道。











