運(yùn)算結(jié)果不對(duì)??!求助!!
#include <stdio.h>
????int gz(float a, int b) { ? ? ? ? ? ? /*定義路程 時(shí)間*/
????float c = 2.3;
????int x = 3;
????int z = 1;
????float zhonghe;
????if (b <= 23 || b >= 6) { ? ?????????/*判斷時(shí)間是否在23點(diǎn)前還是在6點(diǎn)后*/
????c = c * 1.2;
????}
????if (x == 3) { ?????????????????/*起步3公里 */
????a = 9;
????zhonghe = c * a+ 13 + z;
????return zhonghe;
????}
????}
????int main()
????{
????float cc = gz(12, 6);
????printf("%f", cc);
????getchar();
????return 0;
????}
*******************************************************************
結(jié)果是38 ?我用計(jì)算器算了結(jié)果應(yīng)該是34.多少來(lái)著我忘了。
2018-07-31
#include <stdio.h>
int main()
{
? ? double s;
? ? s=13+2.3*(12-3)+1;
? ? printf("%f",s*2);
? ? return 0;
}