asp.net下实现输入数字的冒泡排序
更新时间:2010年03月02日 13:12:30 作者:
.net下实现输入数字的冒泡排序
复制代码 代码如下:
protected void btnSort_Click(object sender, EventArgs e)
{
string array1 = txtSort.Text.Trim();
string[] array21=array1.Split(',');
int dxiao = array21.Length;
int[] array = new int[dxiao];
int temp=0;
for (int i = 0; i < array.Length; i++)
{
array[i] = Convert.ToInt32(array21[i]);
}
for (int i = 0; i < array.Length - 1; i++)
{
for (int j = i + 1; j < array.Length; j++)
{
if (array[j] < array[i])
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
for (int i = 0; i < dxiao; i++)
{
lbsort.Text = lbsort.Text + " " + Convert.ToString(array[i]);
}
}
相关文章
.Net Core3.0 WebApi 项目框架搭建之使用Serilog替换掉Log4j
Serilog 是一个用于.NET应用程序的日志记录开源库,配置简单,接口干净,并可运行在最新的.NET平台上,这篇文章主要介绍了.Net Core3.0 WebApi 项目框架搭建之使用Serilog替换掉Log4j,需要的朋友可以参考下2022-02-02
ASP.NET Core在WebApi项目中使用MiniProfiler分析Entity Frame
这篇文章介绍了ASP.NET Core在WebApi项目中使用MiniProfiler分析Entity Framework Core的方法,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2022-02-02
ASP.NET MVC运行出现Uncaught TypeError: Cannot set property __MVC
同一相站点,有些页面的客户端验证能工作,而有些死活不行。打开页面就出现Uncaught TypeError: Cannot set property __MVC_FormValidation of null错误2010-04-04


最新评论