import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);
         System.out.print("Enter count of numbers: ");
         int count = input.nextInt();
         double[] number = new double[count];
         for(int i = 0; i < count; i++)
             number[i] = input.nextDouble();

         input.close();

         for(double i: number)
             System.out.print(i + " ");
         System.out.println();
         selectSort(number);
         for(double i: number)
             System.out.print(i + " ");
     }

     public static void selectSort(double[] array)
     {
         double maxValue, temp;
         int index;
         for(int i = array.length - 1; i > 0; i--)
         {
             maxValue = array[i];
             index = i;
             for(int j = i - 1; j >= 0; j--)
                 if(array[j] > maxValue)
                 {
                     maxValue = array[j];
                     index = j;
                 }
             if(maxValue > array[i])
             {
                 temp = array[i];
                 array[i] = array[index];
                 array[index] = temp;
             }
         }
     }
 }

最新文章

  1. 【原创】Kafka Consumer多线程实例
  2. 来自沪江、滴滴、蘑菇街架构师的 Docker 实践分享
  3. uart与usart
  4. Cow Exhibition_背包(负数情况)
  5. fineui框架
  6. poj 2828 Buy Tickets (线段树(排队插入后输出序列))
  7. [原博客] POJ 2975 Nim 统计必胜走法个数
  8. android——ImageLoader添加缓存
  9. SQL如何合并查询结果
  10. 【Spring】详解Spring中Bean的加载
  11. Python 简单聊天室
  12. java Domj4读取xml文件加强训练案例
  13. MVVM数据代理
  14. 【ASP.NET Core快速入门】(十四)MVC开发:UI、 EF + Identity实现、注册实现、登陆实现
  15. python网络编程(图片传输)
  16. python3 第三十章 - 内置函数之Dictionary相关
  17. [THUWC2017] 在美妙的数学王国畅游
  18. gethostbyname用法
  19. ROS 可视化(一): 发布PointCloud2点云数据到Rviz
  20. 字符串匹配的Boyer-Moore(BM)算法

热门文章

  1. TIANKENG’s restaurant
  2. Bypass Preventing CSRF
  3. 读取tiled地图
  4. ECNU1101-Dinic
  5. android 图片画画板
  6. log4cxx在linux下的编译和使用
  7. 网上图书商城项目学习笔记-014购物车模块页面javascrip
  8. 支付标记化(Tokenization)技术
  9. itoa函数的实现(不同进制)
  10. PHP使用Mysql事务实例解析