請各位幫忙看看哪里錯(cuò)了 運(yùn)行結(jié)果的數(shù)字很大
#include <stdio.h>
float payshould;
float runfee;
int texifee(int leavetime,float distance)
{
??? if(distance<=3)
??? {
????? runfee==0;
???
??? }
??? else
??? {
??????????? runfee=2.3*(distance-3);
???????????
??? }
??? if(leavetime>=5&&leavetime<23)
??? {
??????? runfee=runfee;
??? }
??? else
??? {
??????? runfee=runfee*1.2;
??? }
??? runfee=runfee+13+1;
??? return 0;
???
}
int main()
{
??? payshould=texifee(9,12)+texifee(18,12);
??? printf("小明每天打的的費(fèi)用為%d元",payshould);
??? return 0;
}
2019-07-26
%d? 其次,你算法有問題,再想想。