「已注销」 2022-09-24 22:28 采纳率: 92.3%
浏览 15
已结题

这个错误在哪里啊,找不到错误了,可以看一看嘛

img

img

img

img


这个错误在哪里啊,找不到错误了,可以看一看嘛,谢谢了,真的看不出来了

  • 写回答

1条回答 默认 最新

  • 梦里逆天 2022-09-24 23:11
    关注

    你说找不到错误?这些你都考虑了吗?==>多组数据、星期五和其他区分吗、满200才减20、优惠券内的汽油不打折

    #include <stdio.h>
    
    int main()
    {
        int t, x;
        float y;
        float order, discount, coupon, payment;
        scanf("%d", &t);
        while (t--)
        {
            discount = 0;
            coupon = 0;
            scanf("%d", &x);
            scanf("%f", &y);
            order = (8.38 * y);
            if (order >= 200)
                coupon = 20;  // 满200减20 
            if (order >= 200)
                y = y - (200 / 8.38);  // 优惠券内购买的汽油不享受折扣 
            discount = y * 0.3;
            if (x == 5)
                discount += y * 0.1;  // 周五额外优惠1毛 
            payment = order - discount - coupon;
            printf("Order amount: %.2f\n", order);
            printf("E-coupon discount amount: %.2f\n", coupon);
            printf("Discount amount: %.2f\n", discount);
            printf("Payment amount: %.2f\n", payment);
        }
        return 0;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 10月13日
  • 已采纳回答 10月5日
  • 创建了问题 9月24日