我調(diào)用的函數(shù)沒(méi)有聲明?
#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("請(qǐng)輸入正確的數(shù)字: ");
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); ?//這里 編譯器說(shuō) getMoney沒(méi)有聲明
printf("小明的搭車費(fèi)用為:%.2f\n",totalMoney);
return 0;
}
2016-01-15
你自己寫錯(cuò)了啊totalMoney=getMoney(distance,mor)+getMoney(distance,aft);第二個(gè)函數(shù)調(diào)用你寫成gerMoney,我也是醉了。