我這里是哪里出了問題
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)計(jì)加分次數(shù)
? ? ? ? while(score<60)
? ? ? ? {
? ? ? ? ? ? score++;
? ? ? ? ? ? count++;
? ? ? ? ? ? {System.out.println("加分后成績:"+score);
? ? ? ? ? ? ? ??
? ? ? ? ? ? }
? ? ? ? else{System.out.println("共加了:"+count+"次!");}}//打印輸出加分后成績,以及加分次數(shù)
? ? }
}
2018-04-17
if只起到了判斷的作用
沒有起到循環(huán)的作用
2018-04-15
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)計(jì)加分次數(shù)
? ? ? ? if(score<60)
? ? ? ? {
? ? ? ? ? ? score++;
? ? ? ? ? ? count++;
? ? ? ? ? ? System.out.println("加分后成績:"+score);
? ? ? ? ? ? System.out.println("共加了:"+count+"次!");
? ? ? ? }
? ? ? ? else
? ? ? ? System.out.println("共加了:"+count+"次!");//打印輸出加分后成績,以及加分次數(shù)
? ? }
}
//了解問題在哪了嗎?