第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

q求大神指點(diǎn),真的看不出那錯(cuò)了,謝謝

我的代碼運(yùn)行成功但是輸出錯(cuò)誤,輸出的只有73.


public class HelloWorld {


? ? //完成 main 方法

? ? public static void main(String[] args) {

? ? int scores[]={89,-23,64,91,119,52,73};

? ? HelloWorld hello = new HelloWorld();

? ? System.out.println("考試前三名的成績(jī)是:");

? ? hello.sort(scores);//調(diào)用方法

? ? ? ??

? ? }

? ??

? ? //定義方法完成成績(jī)排序并輸出前三名的功能

? ? public void sort (int [] arr){

? ? ? ? for(int i=1;i<arr.length;i++){

? ? ? ? ? ? for(int j=0;j<arr.length-i;j++){

? ? ? ? ? ? ? ? if(arr[j+1]>arr[j]){

? ? ? ? ? ? ? ? ? ? int tmp=arr[j];

? ? ? ? ? ? ? ? ? ? arr[j]=arr[j+1];

? ? ? ? ? ? ? ? ? ? arr[j+1]=tmp;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? }//冒泡排序

? ? ? ? int count=0;

? ? ? ? Loop:for(int i=0;i<arr.length-1;i++){

? ? ? ? ? ? if(arr[i]<=100&&arr[i]>=0){

? ? ? ? ? ? ? ? count++;

? ? ? ? ? ? ? ? System.out.println(arr[i]);//符合條件count+1,且輸出

? ? ? ? ? ? ? ?if(count==3){

? ? ? ? ? ? ? ? ? ? break Loop;//超過三名跳出循環(huán)

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? }

? ? ? ??

? ? ? ??

? ? }


}


正在回答

3 回答

public class HelloWorld {
?public static void main(String[] args) {
??? int scores[]={89,-23,64,91,119,52,73};
??? HelloWorld hello = new HelloWorld();
??? System.out.println("考試前三名的成績(jī)是:");
??? hello.sort(scores);//調(diào)用方法
???????
??? }
???
??? //定義方法完成成績(jī)排序并輸出前三名的功能
??? public void sort (int[] arr){
??????? for(int i=1;i<arr.length;i++){
??????????? for(int j=0;j<arr.length-i;j++){
??????????????? if(arr[j+1]>arr[j]){
??????????????????? int tmp=arr[j];
??????????????????? arr[j]=arr[j+1];
??????????????????? arr[j+1]=tmp;
??????????????? }
??????????? }
??????? }//冒泡排序
??????? int count=0;
??????? Loop:for(int i=0;i<arr.length-1;i++){
??????????? if(arr[i]<=100&&arr[i]>=0){
??????????????? count++;
??????????????? System.out.println(arr[i]);//符合條件count+1,且輸出
?????????????? if(count==3){
??????????????????? break Loop;//超過三名跳出循環(huán)
??????????????? }
??????????? }
???????????
??????? }
???????
???????
??? }

}

可以輸出的,里面有些打成中文的了

0 回復(fù) 有任何疑惑可以回復(fù)我~

小哥哥,你的這個(gè)呢:import java.util.Arrays;

1 回復(fù) 有任何疑惑可以回復(fù)我~
#1

SOBER康 提問者

我好像沒用到這個(gè)類吧
2019-01-07 回復(fù) 有任何疑惑可以回復(fù)我~

我知道哪里錯(cuò)了,謝謝

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

q求大神指點(diǎn),真的看不出那錯(cuò)了,謝謝

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)