public class Bubble { public static void main(String[] args) { // TODO Auto-generated method stub int start[] = { 10 , 23 , 11 , 56 , 45 , 26 , 59 , 28 , 84 , 79 }; int i,temp; for(i = 0; i < start.length; i++){ System.out.print(start[i] + " "); } System.out.println(); for(i = 0; i < start.length - 1; i++){ if(start[i] > start[i+1]){ temp = start[i]; start[i] = start[i+1]; start[i+1] = temp; } } for(i = 0; i < start.length; i++){ System.out.print(start[i] + " "); } } }
请大神指出问题所在,谢谢!
混沌木头
相关分类