請大家?guī)兔匆幌逻@段代碼有什么問題import java.util.*;public class Program {? ? public static void main(String[] args) {? ? ? int a[]=new int[9];? ? ? ? int i ,j ;? ? ? ? int t;? ? ? ? Scanner sc=new Scanner(System.in);? ? ? ? for(i=0;i<a.length;i++)? ? ? ? {? ? ? ? ? ? a[i]=sc.nextInt();? ? ? ? }? ? ? ? for(i=a.length-1;i>=0;i--)? ? ? ? {? ? ? ? ? ? for(j=0;j<i;j++)? ? ? ? ? ? {? ? ? ? ? ? ? ? if(a[j]>a[j+1])? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? t=a[j];? ? ? ? ? ? ? ? ? ? a[j]=a[j+1];? ? ? ? ? ? ? ? ? ? a[j+1]=t;? ? ? ? ? ? ? ? }? ? ? ? ? ? }? ? ? ? ? ? ? ??? ? ? ? }? ?? ? ? ? System.out.print("冒泡排序的結(jié)果:");? ? ? ? for(i=0;i<a.length;i++){? ? ? ? ? ? System.out.print(""+a[i]);? ? ? ??? ? ? ?}? ? }}
冒泡排序的問題
qq_慕標(biāo)6304929
2020-03-27 10:01:27