请问我这个简单程序为什么不能运行?
#include <stdio.h>
float fee(int miles)
{
float price;
if(miles<=3)
{
printf("费用为14");
};
else if(miles>3)
{
price=14+(miles-3)*2.3;
printf("费用为:%f",price);
}
return price;
}
int main()
{
printf("费用为:%.1f\n",fee(12));
return 0;
}
#include <stdio.h>
float fee(int miles)
{
float price;
if(miles<=3)
{
printf("费用为14");
};
else if(miles>3)
{
price=14+(miles-3)*2.3;
printf("费用为:%f",price);
}
return price;
}
int main()
{
printf("费用为:%.1f\n",fee(12));
return 0;
}
2017-11-16
#include <stdio.h>
float taxifee(int clock,int miles);
float money=0;
int clock=0;
int miles=0;
{
if(miles<=3)
{
money=14;
printf("打车费14\n");
}
else
{
if(clock>=23 || clock<5)
{
money=1.2*(miles-3)*2.3+14;
printf("打车费%f\n",money);
}
else
{
money=(miles-3)*2.3+14;
printf("打车费%f\n",money);
}
}
return money;
}
int main()
{
printf("%f\n",taxifee(9,12)+taxifee(18,12));
return 0;
}
举报