代碼中count++是什么意思?
public?class?helloworld?{
? ? public?static?void?main(String[]?args){
? ? ? ? int?num?=?999;
? ? ? ? int?count?=?0;
? ? ? ? if?(num?>=?0?&&?num<=999999999){
? ? ? ? ? ? while(num?!=?0){
? ? ? ? ? ? ? ? count++;
? ? ? ? ? ? ? ? num/=10;// a/=b等同于a=a/b
? ? ? ? ? ? }
? ? ? ? ? ? System.out.println("他是個"+count+"位的數!");
? ? ? ? }else{
? ? ? ? ? ? System.out.println("輸入有誤!");
? ? ? ? }
? ? }
}
2016-02-28
count是位數。count++是count=count+1。當num不等于0時,count至少是1.所以先執行count++,然后再判斷num是否是高位數。
2016-02-28
count++ ?--> 即count自加,相當于:count=count+1;
2016-02-28
count++是count加1,代碼類似于count=count+1;