[問題] 新手發問
public class First {
public static void main (String[] 參數) {
int up, low;
double result;
String ans = "繼續";
String choice = "繼續";
while(ans == choice){
System.out.println("請輸入上底");
up = input.nextInt();
System.out.println("請輸入下底");
low = input.nextInt();
System.out.println("請輸入高");
result = (up + low) * input.nextInt() / 2;
System.out.println("面積 = "+result);
System.out.println("是否繼續?");
choice = input.nextLine(); //為啥這行執行時沒執行到就結束了?
}
}
}
新手發問 最後一行 註解那邊
我是想要讓使用者決定要不要繼續下一次的執行
但是好像程式執行時沒執行到那行就結束了
請問是怎麼了 怎麼解決?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.70.237.127
推
07/29 00:23, , 1F
07/29 00:23, 1F
→
07/29 00:36, , 2F
07/29 00:36, 2F
→
07/29 00:49, , 3F
07/29 00:49, 3F
→
07/31 13:55, , 4F
07/31 13:55, 4F
討論串 (同標題文章)