亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
這個括號有點蹊蹺
[打印本頁]
作者:
mcmay
時間:
2013-01-26 17:54
標(biāo)題:
這個括號有點蹊蹺
/*一個計算汽車行駛里程與耗油量的關(guān)系的代碼*/
#include <stdio.h>
int main(void)
{
const float GTOL = 3.785;
const float MTOK = 1.609;
float mile, gallon, converted_val;
printf("Input the mile(s) traveled: ");
scanf("%f",&mile);
printf("Input the gallon(s) used: ");
scanf("%f",&gallon);
printf("Mile(s) per gallon: %.1f",mile/gallon);
//converted_val = gallon * GTOL / (mile * MTOK * 100.0); 計算結(jié)果為0.0
converted_val = gallon * GTOL / mile * MTOK * 100.0;
printf("\nLiter(s) per 100 kilometers: %.1f", converted_val);
puts("\nDone!");
return 0;
}
復(fù)制代碼
請問為何代碼當(dāng)中被注釋掉的那一行里的計算結(jié)果會為0.0呢?是不是跟括號的優(yōu)先級有關(guān)呢?就算是先計算除數(shù)也應(yīng)該不會讓結(jié)果為零啊。請各位指教!
歡迎光臨 Chinaunix (http://www.72891.cn/)
Powered by Discuz! X3.2