C#的冒泡排序
来源:互联网 发布:广州番禺网络花店 编辑:程序博客网 时间:2024/05/11 03:19
using System;//引入命名空间using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace C_Sharp//命名空间定义{ class Program//类Program定义 { static void Swap(ref int x,ref int y) { x ^= y; y ^= x; x ^= y; } static void Main(string[] args) { int[] a = new int[100]; Console.WriteLine("输入int数组里的元素数目"); string s = Console.ReadLine(); int len = Int32.Parse(s); Console.WriteLine("输入元素"); for(int j = 0; j < len; ++j) { string s1 = Console.ReadLine(); a[j] = Int32.Parse(s1); } int limit = len - 1; for(int pass = 0; pass < len - 1; pass++) { for(int j = 0; j < limit - pass; j++) { if (a[j] > a[j + 1]) { Swap(ref a[j], ref a[j + 1]); } } } Console.WriteLine("排序完成,遍历得"); for(int i = 0; i < len; ++i) { Console.WriteLine(a[i]); } Console.ReadKey(); } }}
0 0
- c#的冒泡排序
- C#的冒泡排序
- C#的冒泡排序
- C# 可怜的冒泡排序!!!
- C#冒泡排序的实现
- 一个 C# 版的冒泡排序法
- 一个 C# 版的冒泡排序法
- 一个 C# 版的冒泡排序法
- 一个C#的冒泡排序算法
- C#中的委托版的冒泡排序
- C#中简单的冒泡排序
- C#双向链表的冒泡排序
- 19、C#里面的冒泡排序操作
- 冒泡排序C#版
- C# 冒泡排序
- c# 冒泡排序
- C#冒泡排序
- C# 冒泡排序!
- Java发展史
- 如何在github上传自己的项目
- 设计模式
- android高级工程师应该会的知识
- 数方块
- C#的冒泡排序
- 数据清洗-python代码实现
- Linux进程浅析(上)
- Head First 设计模式(一)策略模式
- 你的Log也可以定制
- Wikiot-DIY笔记(0)简介
- Linux进程浅析(中)
- node安装和升级相关
- IC项目,门级代码的工艺库移植