国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

把一個int數組的數字從小到大排列(C#)

2024-07-21 02:17:26
字體:
來源:轉載
供稿:網友
 

using system;

namespace consoleapplication1
{
 /// <summary>
 /// class1 的摘要說明。
 /// </summary>
 class class1
 {
  /// <summary>
  /// 應用程序的主入口點。
  /// </summary>
  [stathread]
  static void main(string[] args)
  {
   mintomax mtm= new mintomax();
   int [] array = {1,2,6,3,8,3,4,0,5,23,52,12,234,235,1232,21,234,123,143,1368};
   int[] last=mtm.mtm(array);
   int n=0;
   for(int i=0;i<array.length;i++)
   {
    system.console.write(last[i]+"<");
    ++n;
   
   }
   system.console.writeline("/n總共{0}個數字",n);

   system.console.readline();
   //
   // todo: 在此處添加代碼以啟動應用程序
   //
  }
 }

 public class mintomax
     {
  public int[] mtm(int [] array)

  {  
   int[] fianlmtm= new int[array.length];
   
   for(int j=0;j<array.length;j++)
   {
    int last=0;
    for(int i=1;i<array.length-j;i++)
    {
     int t = array[i];
     
     if ((array[i])<(array[i-1]))
     {
    
      array[i]=array[i-1];
      last=array[i];
      array[i-1]=t;
     
     }
     else
      last=array[i];

    

    }
                   fianlmtm[array.length-(j+1)]=last;

  }
   return fianlmtm;
  
  }
     }
}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 海城市| 蓝田县| 五指山市| 高邮市| 北流市| 通化市| 南阳市| 罗田县| 望城县| 南澳县| 吉首市| 綦江县| 阿瓦提县| 建宁县| 阿克陶县| 册亨县| 南通市| 石景山区| 苏尼特右旗| 垣曲县| 宜兰市| 蓝山县| 贡嘎县| 神农架林区| 平度市| 友谊县| 台安县| 瑞丽市| 五华县| 平泉县| 临沂市| 凤凰县| 舒城县| 砀山县| 德兴市| 肥乡县| 漯河市| 万山特区| 虎林市| 浦城县| 六安市|