array.sort()可以快速排序
然后,因为n>m,直接拷贝会溢出
用foreach吧

解决方案 »

  1.   

    int temp=0;
            int[] a = new int[5];
            int[] b = new int[6];
            a[0] = 1;
            a[1] = 5;
            a[2] = 8;
            a[3] = 4;
            a[4] = -1;
            for (int j = 0; j < a.Length; j++)
            {
                for (int i = 0; i <a.Length; i++)
                {
                    if (a[j] < a[i])
                    {
                        temp = a[j];
                        a[j] = a[i];
                        a[i] = temp;
                    }                b[i] = a[i];
                    
                }
                        }
            for(int i=0; i<b.Length;i++)
                Response.Write(b[i]);这是一个思路,你可以试试.你可以再去重构一下.多多交流
      

  2.   

    int   temp=0; 
                    int[]   a   =   new int[5]; 
                    int[]   b   =   new   int[6]; 
                    a[0]   =   1; 
                    a[1]   =   5; 
                    a[2]   =   8; 
                    a[3]   =   4; 
                    a[4]   =   -1; 
                    for   (int   j   =   0;   j   <   a.Length;   j++) 
                    { 
                            for   (int   i   =   0;   i   <a.Length;   i++) 
                            { 
                                    if   (a[j]   >   a[i]) 
                                    { 
                                            temp   =   a[j]; 
                                            a[j]   =   a[i]; 
                                            a[i]   =   temp; 
                                    }                                 b[j]   =   a[j]; 
                                    
                            } 
                                            } 
                    for(int   i=0;   i <b.Length;i++) 
                            Response.Write(b[i]); 
      

  3.   

                int[] a = new int[7] {80, 3, 10, 45, -1, 0, 100 };
                int[] b = new int[6];
                int temp = 0;
                for (int j = 0; j < a.Length; j++)
                {
                    for (int i = 0; i < b.Length; i++)
                    {
                        if (a[j] < a[i])
                        {
                            temp = a[j];
                            a[j] = a[i];
                            a[i] = temp;
                        }
                        b[i] = a[i];
                    }
                }
                foreach (int num in b)
                {
                    Console.WriteLine(num);
                }
      

  4.   

    将数组a排序,用for循环取得b数组的维度,同时将数组a的数值复制到数组b中
    a.sort();
    for(int i=0,i<b.Length;i++)
    {
        b[i] = a[i];
    }
      

  5.   

    海辉??原来的天海宏业?呵呵...
    兄弟,测试做多久了?英文怎么样?我这有个赴美国GOOGLE的本地化项目
    如果你觉得条件符合,PM我.