Bubblesorta 要return arrayList;
或者public void Bubblesorta(ref int[] arrayList)这样声明
或者public void Bubblesorta(ref int[] arrayList)这样声明
解决方案 »
- Win API GetPixel 为什么在 WIN2008 32位 SP1 取得的数据全为 空呢? 谢谢
- 请教一个报表方面的问题。欢迎大家来指点。
- c# 何如取excel文件第1个表的内容
- dllimport 构造函数
- 急啊! 怎么判断TextBox的数据是不是符合decimal(18, 2)?
- 关于[大字体]的问题
- 为何我把数据表和DataTable绑定后,参数也会自动存在么。
- 这多题怎么做呀?帮帮忙吧,一题5分。
- 急!!! Asp.net AD认证,异常信息:该服务器不可操作。。
- 怎么得到于进程关联的端口,或者怎么得到全部进程的全部句柄!在线等待!
- [c#]如何移除 form右上角的x钮,只留下放大跟缩小钮。
- 邮件发送
public void Bubblesorta(ref int[] arrayList)
{
int i, j, temp;
//bool temp;
for (j = 1; j <= arrayList.Length - 1; j++)
for (i = 0; i < arrayList.Length - j; i++)
if (arrayList[i] > arrayList[i + 1])
{
temp = arrayList[i]; arrayList[i] = arrayList[i + 1]; arrayList[i] = temp;
}
}
public void Bubblesorta(int[] arrayList)
{
int i, j, temp;
//bool temp;
for (j = 1; j <= arrayList.Length - 1; j++)
{
for (i = 0; i < arrayList.Length - j; i++)
{
if (arrayList[i] > arrayList[i + 1])
{
temp = arrayList[i];
arrayList[i] = arrayList[i + 1];
arrayList[i + 1] = temp;
}
}
}
}static void Main(string[] args)
{
int[] arr = new int[] { 1, 5, 13, 6, 10, 55, 99, 2, 87, 12, 34, 75, 33, 47 };
Program1 p = new Program1();
p.Bubblesorta(arr);
for (int m = 0; m < arr.Length; m++)
Console.WriteLine("{0} ", arr[m]);
Console.WriteLine();
Console.ReadKey();
}
class Program
{
static void Main()
{
int[] arr = { 1, 5, 13, 6, 10, 55, 99, 2, 87, 12, 34, 75, 33, 47 };
System.Array.Sort(arr);
foreach (int m in arr)
{
System.Console.WriteLine(m);
}
}
}