我調用的函數沒有聲明?
#include <stdio.h>
double getMoney(int distance,int hours)
{
double totalMoney = 0.00;
double per=2.30;
double sta=13.00;
if(hours<0 || hours >24)
{
printf("請輸入正確的數字: ");
return 0;
}
else if(hours>5 && hours <=23)
{
per *= 1.2;
}
if(distance<=3)
{
totalMoney = sta;
}
else?
{
totalMoney=sta+(distance - 3)*per;
}
totalMoney++;
return totalMoney;
}
int main ()
{
double totalMoney;
int mor=9;
int aft=18;
int distance=12;
double per=2.30;
totalMoney=getMoney(distance,mor)+gerMoney(distance,aft); ?//這里 編譯器說 getMoney沒有聲明
printf("小明的搭車費用為:%.2f\n",totalMoney);
return 0;
}
2016-01-15
你自己寫錯了啊totalMoney=getMoney(distance,mor)+getMoney(distance,aft);第二個函數調用你寫成gerMoney,我也是醉了。