以下整数{12,456,345,23,13}的最高编号到最低编号递增; [英] ascending numbers from greatest to lowest of this following integers {12,456,345,23,13};

查看:58
本文介绍了以下整数{12,456,345,23,13}的最高编号到最低编号递增;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请回答我的问题tnx ..此以下整数从最大到最小的递增数字{12,456,345,23,13}

please ans my question tnx..ascending numbers from greatest to lowest of this following integers {12,456,345,23,13}

推荐答案

尝试:
Console.WriteLine(456);
Console.WriteLine(345);
Console.WriteLine(23);
Console.WriteLine(13);
Console.WriteLine(12);


使用排序方法.
Use List<t> collection class. It has Sort method.
List<int> myList = new List<int>();
myList.AddRange(new int[] {12,456,345,23,13}); 
myList.Sort();



或者您可以坚持使用Array类.



Or you can stick to Array class.

int[] myArray = new int[] {12,456,345,23,13};
Array.Sort(myArray);



甚至更低的级别,您也可以使用一些经过验证的选择排序.



Or even lower level you can do it by using some proven algorithm.

Hint: for homework and small collections I would use selection sort.


这篇关于以下整数{12,456,345,23,13}的最高编号到最低编号递增;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆