看板 java 關於我們 聯絡資訊
題外話... 這個 max function .... XD ※ 引述《dollow333 (打內SHOW)》之銘言: : public static int max(int compare1, int compare2, int compare3) { : int ascNumber[]={compare1, compare2, compare3}; : int bubbleTemp=-1; : for (int max1=0; max1<2; max1++) : for(int max2=max1+1; max2<3; max2++){ : if(ascNumber[max1]>ascNumber[max2]){ : bubbleTemp=ascNumber[max1]; : ascNumber[max1]=ascNumber[max2]; : ascNumber[max2]=bubbleTemp; : } : } : return ascNumber[2]; : } 其實可以這樣: int max = compare1; if (max < compare2) max = compare2; if (max < compare3) return compare3; return max; 除非題目注明一定要先用 bubble sort XD -- 很多人以為 所以我要 其實我是個快 我是大學生 告訴大家 三十歲的怪叔叔 ● ●/ ︿ ︿ /\ < ● ㄨ /\ ㄨ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 147.8.130.225