110,534
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int[] a = {0,1,2,3,4,5,6,7,8,9};
func(ref a);
for (int i=0; i<a.Length; i++)
{
Console.Write("{0} ",a[i]);
}
Console.ReadKey();
}
static void func(ref int[] a)
{
for (int i = 0; i < a.Length; i++)
for (int j = i; j < a.Length; j++)
if (a[i] < a[j])
a[i] ^= a[j] ^= a[i] ^= a[j];
}
}
}
a[i] ^= a[j] ^= a[i] ^= a[j];
a[i] = a[i] ^ a[j];
a[j] = a[j] ^ a[i];
a[i] = a[i] ^ a[j];
int i=1;
i=(i+(i=i+1));
Console.WriteLine(i);