for (int t = i+1; t < a.Length; t++)

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.Text;namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                int[] a = new int[] { 3, 5, 7, 8, 3, 2, 3, 45, 76, 21 };
                for (int i = 0; i < a.Length; i++)
                {
                    for (int t = 0; t < a.Length; t++)
                    {
                        if (a[i] < a[t])
                        {
                            int n;
                            n = a[i];
                            a[i] = a[t];
                            a[t] = n;                    }                }            }
                for (int m = 0; m < a.Length; m++)
                {
                    Console.Write(a[m] + " ");
                }            System.Console.Read();        }
        }
    }