对数组进行排序并重新显示出来
2017-07-06 21:32
267 查看
static void Main(string[] args)
{
int[] arr1 = new int[] { 1, 3, 4,232, 4, 23, 222, 3, 3, 21, 87 };
//对数组进行排序
Array.Sort(arr1);
//反转数组从大到小
Array.Reverse(arr1);
//数组排序后再将数组内容显示出来
foreach (int i in arr1)
{
Console.WriteLine(i);
}
Console.ReadKey();
{
int[] arr1 = new int[] { 1, 3, 4,232, 4, 23, 222, 3, 3, 21, 87 };
//对数组进行排序
Array.Sort(arr1);
//反转数组从大到小
Array.Reverse(arr1);
//数组排序后再将数组内容显示出来
foreach (int i in arr1)
{
Console.WriteLine(i);
}
Console.ReadKey();
相关文章推荐
- 前端对后台传过来是数组进行重新排序显示
- n个实数(仅包含正实数和负实数)组成的数组A进行重新排序, //使得其中的所有的负实数都要在正实数之前
- 对数组进行重新排序
- 在控制台中输入一个数组,并对这个数组进行重新排序,将第一个数和最后一个交换,将第二个和倒数第二个交换
- 数组中添加数据后并排序显示出来
- 以行为单位对字符串变量下标为奇数位置上的字符按其ASCii值从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组xx中
- 将数组中的对象按照浏览器的x/y轴的显示方式进行排序
- 有一串字符串a12hh123mm21m78 ,请将其中的数字提取出来存入数组,使用选择排序算法将其进行排序:
- 百度笔试题:一个已经排序好的很大的数组,现在给它划分成m段,每段长度不定,段长最长为k,然后段内打乱顺序,请设计一个算法对其进行重新排序
- 读入文本文件data.txt中的整数,调用sort()对数组arr元素排序,最后显示出来
- 读xml文档中数据并对其进行排序,然后在datagrid中显示出来
- 冒泡法对数组进行排序
- 利用随机类生成数组,并用冒泡排序以及选择排序对不同数组的元素进行从小到大的排序
- XSLT分页显示XML数据并对所有数据重新排序
- XSLT对XML数据进行分页且可以按某个值重新排序的方法
- 求助水晶报表动态饼图显示、求助进行数据查询和把查询结果用图表比较出来
- asp下实现 重新排序数字数组的代码
- 用ArrayList对数组进行排序
- 对一个数组进行排序,这个数组可以是整型、浮点型
- 使用该JavaBean可以将数据在JSP页面中以表格的形式显示出来,并具有动态排序、动态生成查询、自动分页功能