根據(jù)點(diǎn)贊第一輸入的,怎么只顯示加分前成績
public static void main(String[]args){
// 變量保存成績
? ? ?int score = 53;?
? ? ?
? ? ?// 變量保存加分次數(shù)
? ? ?int count = 0;
? ? ?//打印輸出加分前成績?
? ? ? ?System.out.println("加分前成績:"+score);
? ??
? ? ?
? ? ?// 只要成績小于60,就循環(huán)執(zhí)行加分操作,并統(tǒng)計(jì)加分次數(shù)
? ? ?if (score<60){
? ? ? ? ?for( ;score<60;count++);{
? ? ? ? ?score++;
? ? ?}
? ? ?System.out.println("加分后成績:"+score);
? ? ?System.out.println("共加了"+count+"次");
? ? ?}
? ? ?
}
}?
2017-02-05
我知道為什么了 ,你的for循環(huán)小括號之后有一個分號;
你需要保持好的編碼習(xí)慣
2017-02-05
我把那個點(diǎn)贊第一的跑了一遍,沒有問題啊
2017-02-05
你那個循環(huán)換一下
while(score < 60){
?? ??? ??? ?score++;
?? ??? ??? ?count++;
? }
? System.out.println("新的成績:"+score);
? System.out.println("加的次數(shù):"+count);
2017-02-05
int score=53;
??int count=0;
??System.out.println("加分前成績:"+score);
??for (;score<60;){
????score++;
????count++;???
??}
??System.out.println("加分后成績:"+score);
??System.out.println("共加分"+count+"次");