| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 834 人关注过本帖
标题:指点下,哪里有问题
取消只看楼主 加入收藏
sz1233321
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-10-6
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
指点下,哪里有问题
#include <stdio.h>
#define AMT_SINGLE 17850
#define AMT_HOUSEHOLDER 23900
#define AMT_MARRY 29750
#define AMT_DIVORCE 14875
#define RATE1 0.15
#define RATE2 0.28

int main(void)
{
    double salary,tax;
    double amt;
    int index;
    int i;

    printf("Which kind of tax payment you fitted,\nPlease input the number showed below (q to quit): \n");
    printf("***************************************\n");
    printf("1) Single          2)Householder\n");
    printf("3) Married         4)Divorced\n");
    printf("5) Quit\n");
    printf("***************************************\n");

    while(scanf("%d",&index) == 1)
    {

        switch (index)
        {
            case 1:amt = 17850;i = 1;break;
            case 2:amt = 23900;i = 1;break;
            case 3:amt = 29750;i = 1; break;
            case 4:amt = 14875;i = 1; break;
            case 5:i = 0;break;
            default:printf("Please input the fallowing number(1~4): \n");i = scanf("%d",&index);break;
        }
        while (i)
        {
            printf("Next Type # to return previous level or input your Gross salary: ");
            while ((i = scanf("%lf",&salary)) == 1 )
            {
                if (salary > 0)
                    tax = (salary > amt ? (salary - amt) * RATE2 + amt * RATE1:amt * RATE1);
                else
                    printf("Wrong,type the positive number\n");

                printf("Your gross salary %0.2lf\n",salary);
                printf("Your tax: %.2lf\n",tax);
                printf("Net income: %0.2lf\n",salary - tax);
                printf("Type # to return previous level or salary :");
            }
        }
        printf("***************************************\n");
        printf("1) Single          2)Householder\n");
        printf("3) Married         4)Divorced\n");
        printf("5) Quit\n");
        printf("***************************************\n");
        printf("Which kind of tax payment you fitted,\nPlease input the number showed above (q to quit): \n");
    }

    return 0;
    }
搜索更多相关主题的帖子: define index printf case break 
2018-10-06 10:49
快速回复:指点下,哪里有问题
数据加载中...
 
   



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

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