数组的排序
来源:互联网 发布:html5media.min.js 编辑:程序博客网 时间:2024/06/11 22:03
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int[] arry = new int[10] { 2, 5, 8, 4, 6, 1, 3, 9, 7,0 };
int temp;//中介数
for (int i = 0; i < arry.Length; i++)
{
for(int j=0;j<arry.Length;j++)//arry.Length为数组长度
{
if(arry[i]<arry[j])
{
temp = arry[i];//俩个数的交换
arry[i] = arry[j];//
arry[j] = temp;//
}
}
}
foreach (int n in arry)
Console.Write(n);
Console.Write("\n");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int[] arry = new int[10] { 2, 5, 8, 4, 6, 1, 3, 9, 7,0 };
int temp;//中介数
for (int i = 0; i < arry.Length; i++)
{
for(int j=0;j<arry.Length;j++)//arry.Length为数组长度
{
if(arry[i]<arry[j])
{
temp = arry[i];//俩个数的交换
arry[i] = arry[j];//
arry[j] = temp;//
}
}
}
foreach (int n in arry)
Console.Write(n);
Console.Write("\n");
}
}
}
阅读全文
0 0
- 多维数组、数组的排序
- 数组的排序:冒泡排序、选择排序
- 数组的排序
- 数组的排序学习!!
- 二维数组的排序
- 数组排序的问题
- javascript的数组排序
- 二维数组的排序
- php数组的排序
- 各种数组的排序
- javascript的数组排序
- PHP数组的排序
- 数组的归并排序
- 数组的排序
- 二维数组的排序
- 数组的排序
- JAVA数组的排序
- java 数组的排序
- redis搭建知道
- G
- 杭电 OJ 1157
- 二叉树
- java项目几种常见数据库连接池的使用比较
- 数组的排序
- 【数据结构】链表的实现(带头节点)
- HDU 6047 Maximum Sequence (贪心)
- 第003讲:插曲之变量和字符串 ---学习笔记
- InfluxDB使用总结与性能优化
- HDU_【2017 Multi-University Training Contest 1】——1003 color tree
- 设计模式-单例模式
- 整数拆分 生成函数 模版
- 百度地图API使用——基础地图