#include <stdio.h>
#include <math.h>

int main()
{
    double distance, waitingTime, totalFee;
    int startFee = 10, fee1 = 2, fee2 = 3, startDistance = 3, freeDistance = 10;

    printf("请输入行驶里程(公里):");
    scanf("%lf", &distance);
    printf("请输入等待时间(分钟):");
    scanf("%lf", &waitingTime);

    // 计算里程费用
    if (distance <= startDistance) {
        totalFee = startFee;
    } else if (distance <= freeDistance) {
        totalFee = startFee + fee1 * (distance - startDistance);
    } else {
        totalFee = startFee + fee1 * (freeDistance - startDistance) + fee2 * (distance - freeDistance);
    }

    // 计算等待费用
    totalFee += ceil(waitingTime / 5) * fee1;

    // 尾数四舍五入
    totalFee = round(totalFee);

    printf("乘客应支付的车费为 %.0f 元\n", totalFee);

    return 0;
}
出租车收费。某城市普通出租车收费标准如下:起步里程3公里起步费用10元;超起步里程后10公里内每公里租费2元;超过10公里以上的部分加50的回空补贴费即每公里租费3元。营运过程中因路阻及乘客要求临时停车的每5分钟按1公里租费计收。运价计费尾数四舍五入保留到元。编写程序输入行驶里程公里与等待时间分钟计算并输出乘客应支付的车费元。 用c语言

原文地址: http://www.cveoy.top/t/topic/Jqv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录