不懂問題出在哪里
public class HelloWorld {
??? public static void main(String[] args) {
???????
??????? // 變量保存成績
??????? int score = 53;
???????
??????? // 變量保存加分次數(shù)
??????? int count = 0;
??????? //打印輸出加分前成績
??????? System.out.println("加分前成績:" +score);?
??????
???????
??????? // 只要成績小于60,就循環(huán)執(zhí)行加分操作,并統(tǒng)計加分次數(shù)
??????? do{
??????????? score = score + count;
??????????? count = count++;
??????? }while(score <= 60);
???????
???????
???????
???????
???????
???????
??????? //打印輸出加分后成績,以及加分次數(shù)
????? System.out.println("加分后成績:" +score );
????? System.out.println("共加了"+count+"次!");
2018-07-11
不要用do while ?這么寫是先進(jìn)行一次加分在判斷score<=60.你的問題在于每次循環(huán)加分不是加1分,你加的是循環(huán)次數(shù)改成?score++;
? while(score<60){
? ? ? ? ? ? count++;
? ? ? ? ? ? score++;
? ? ? ? ? ??
? ? ? ? }
2018-06-06
?do{
? ? ? ? ? ? score++;
? ? ? ? ? ? count++;
? ? ? ? }while(score < 60);
我試了這樣運行可以的,你改下看看,因為你的count 先加了1,所以score不能等于60 了
2018-05-31
? ?do{
??????????? score? += count;
??????????? count = count++;
??????? }while(score <= 60);
2018-05-30
?score = score + count;這樣執(zhí)行第一次是加一,但是第二次就是加二了