| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 361 人关注过本帖
标题:哪里出了问题呀
取消只看楼主 加入收藏
huangwei1329
Rank: 2
等 级:论坛游民
帖 子:27
专家分:13
注 册:2011-10-18
结帖率:100%
收藏
 问题点数:0 回复次数:0 
哪里出了问题呀
#include<stdio.h>
#define A 1.25
#define B 0.65
#define C 0.89
#define D "朝鲜蓟"
#define E "甜菜"
#define F "胡萝卜"
#define G 100.0
#define H 5.0
#define I 20.0
#define J 0.05
#define K 3.5
#define L 10.00
#define M 8.0
#define N 0.1
void hs(void);

int main(void)
{
    char c_a;
    double d_a, d_b, d_c;
    double d_d = 0, d_e = 0, d_f = 0, d_g = 0, d_h = 0, d_i = 0;
    double d_j = 0, d_k = 0, d_l = 0, d_m = 0, d_n = 0, d_o = 0;

    while(1)
    {
        hs();
        c_a = getchar();
        printf("0");
        if(c_a == 'q')
            goto a;
        while(1)
        switch(c_a)
        {
            case 'a': d_a = A;
                      printf("请输入朝鲜蓟的磅数:");
                      goto b;
            case 'b': d_a = B;
                      printf("请输入甜菜的磅数:");
                      goto b;
            case 'c': d_a = C;
                      printf("请输入胡萝卜的磅数:");
                      goto b;
            case 'q': goto a;
            default: hs();
                     c_a = getchar();
        }
        b:
        scanf("%lf", &d_b);
        d_c = d_b * d_a;
        if(c_a == 'a')
            d_d += d_b;
            d_e += d_c;
        if(c_a == 'b')
            d_f += d_b;
            d_g += d_c;
        if(c_a == 'c')
            d_h += d_b;
            d_i += d_c;
    }
    a:
    d_j = d_d + d_f + d_h;
    if(d_j > H)
    {
        if(d_j > 20)
        {
            d_k = M + d_j * N;
            d_l = N;
        }
        else
            d_k = L;
    }
    else
        d_k = K;
    d_m = d_e + d_g + d_i;
    d_n = d_m / d_j;
    if(d_m > 100)
        d_o = d_m * J;
    printf("每磅的费用是%.2f。\n", d_n);
    printf("订购的磅数%0.2f。\n", d_j);
    printf("该定单%s的费用是%.2f。\n", D, d_e);
    printf("该定单%s的费用是%.2f。\n", E, d_g);
    printf("该定单%s的费用是%.2f。\n", F, d_i);
    printf("订单的总费用是%.2f。\n", d_m);
    printf("拆扣是%.2f。\n", d_l);
    printf("运输费用是%.2f。\n", d_k);

return 0;
}

void hs (void)
{
    printf("请选择:\n");
    printf("********************************\n");
    printf("a) 朝鲜蓟的售价是1.25美元/磅。\n");
    printf("b) 甜菜的售价是0.65美元/磅。\n");
    printf("c) 胡萝卜的售价是0.89美元/磅。\n");
    printf("q) 退出。\n");
    printf("********************************\n");
}
搜索更多相关主题的帖子: double void include 胡萝卜 
2012-06-09 18:48
快速回复:哪里出了问题呀
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054205 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved