import java.util.Scanner;
public class testArray {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int Max=0;
int[] score = new int[5]; //自定义数组长度
System.out.println("please input five numbers:");
for(int i=0; i< score.length; i++){
score[i] = input.nextInt();
}
for(int j=0; j<score.length-1; j++){
swap(score); //调用数组排序方法
}
System.out.println("########## the result: ###########");
for(int i=0; i<score.length; i++){
System.out.print(score[i]+"\t");
}
}
public static void swap(int[] arr){ //冒泡法排序
for(int i=0; i<arr.length-1; i++){
if(arr[i]>arr[i+1]){
int temp = arr[i];
arr[i] = arr[i+1];
arr[i+1] = temp;
}
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有