C#使用sort方法对数组进行快速排序
2015-07-29 18:36
531 查看
效果图:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 使用sort方法对数组进行快速排序
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int[] j = new int [10];
private void button1_Click(object sender, EventArgs e)
{
Random r = new Random();
for (int i = 0; i < 10; i++)
{
int sum = r.Next(0,100);
j[i] = sum;
textBox1.Text += sum.ToString()+",";
}
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox1 != null)
{
Array.Sort(j);
foreach (int i in j)
{
textBox2.Text += i.ToString()+",";
}
}
}
}
}
资源下载地址:http://download.csdn.net/detail/qq_28597703/8944115
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 使用sort方法对数组进行快速排序
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int[] j = new int [10];
private void button1_Click(object sender, EventArgs e)
{
Random r = new Random();
for (int i = 0; i < 10; i++)
{
int sum = r.Next(0,100);
j[i] = sum;
textBox1.Text += sum.ToString()+",";
}
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox1 != null)
{
Array.Sort(j);
foreach (int i in j)
{
textBox2.Text += i.ToString()+",";
}
}
}
}
}
资源下载地址:http://download.csdn.net/detail/qq_28597703/8944115
相关文章推荐
- C# RichTextBox 中用栈实现代码的自动缩进
- C#的注释和快速开启工具的命令
- C#编码规范
- C#的一个异常
- 泛型
- 关于C#中的Attribute的简单理解
- C#中Stack<T>类的使用及部分成员函数的源码分析
- C#中Stack<T>类的使用及部分成员函数的源码分析
- C#的pictureBox怎样使用多张图片简单切换
- C# 系列——未能找到路径“..”的一部分
- c#系列——“OSGeo.GDAL.GdalPINVOKE”的类型初始值设定项引发异常。
- 改进C# WinForm窗体及其控件的自适应
- C#中各种计时器
- c# 父类的引用指向子类的实例
- C#中的事务
- C#系列——实现鼠标忙碌状态
- C#面向对象三大特性之三:多态
- C#两路list数组归并去重
- C# WinForm开发系列 - Open-Source Controls
- C# WinForm开发系列 - ListBox/ListView/Panel