package com.vci.client.framework.specialrole;
|
|
import java.util.Scanner;
|
|
public class Test {
|
|
/**
|
* 排序
|
* @param str
|
*/
|
public void compareMaxMin(int str[]){
|
int temp;
|
for(int i=0;i<str.length;i++){
|
for(int j=i+1;j<str.length;j++){
|
if(str[i]>str[j]){
|
temp=str[i];
|
str[i]=str[j];
|
str[j]=temp;
|
}
|
}
|
}
|
for(int k=0;k<str.length;k++){
|
System.out.println(str[k]+"");
|
}
|
}
|
|
public static void main(String[] args) {
|
Scanner sc= new Scanner(System.in);
|
System.out.println("输入第一个数:");
|
int a = sc.nextInt();
|
System.out.println("输入第二个数:");
|
int b = sc.nextInt();
|
System.out.println("输入第三个数:");
|
int c = sc.nextInt();
|
System.out.println("输入第四个数:");
|
int d = sc.nextInt();
|
int[] str = {a,b,c,d};
|
Test t = new Test();
|
t.compareMaxMin(str);
|
}
|
}
|