输入一周的工作小时,显示粽子总额税金以及净工资,结果无数据,单步运行可以,该怎么解决

输入一周的工作小时,显示粽子总额税金以及净工资,结果无数据,单步运行可以
#include <stdio.h>
#define BASE 10.00、、当不超过40小时时,每小时10元
#define MULT 1.5 //规定超过40小时,所超时间按1.5倍计算
#define RATE1 0.15 //前300税率为0.15
#define RATE2 0.2//接着150按0.2
#define RATE3 0.25//余下的按0.25
int main(void)
{
int hour,exp;
double total,tax,salary,base_salary,exp_salary;

printf("input the hours of your work in one week.\n");
scanf("%d",&hour);

  //计算工资总额
if(hour <= 40)
total = hour * BASE;
else
{
exp = hour - 40;
exp_salary = exp * MULT * BASE;
base_salary = 40 * BASE;
total = base_salary + exp_salary;
}

  //税金和净工资

if(total <= 300)
{
tax = total * RATE1;
salary = total - tax;
}
else
{
if(total <= 450)
{
tax = 300 * RATE1 +(total - 300) * RATE2;
salary = total - tax;
}
else
{
tax = 300 * RATE1 + 150 * RATE2 +(total - 450) * RATE3;
salary = total - tax;
}
}
printf("the total salary is %ld,and the real salary is %ld,and the tax is %ld\n",total,salary,tax);

return 0;
}

我单步运行时,total,salary以及tax里都有数值,但是整体运行时total和tax里一直为0,而salary里的值很大,我想应该是系统随意付的值

分不多,不过希望大家给指点一下,谢谢

------解决方案--------------------
printf("the total salary is %f,and the real salary is %f,and the tax is %f\n",total,salary,tax);

你的变量是double,不能用%ld打印
------解决方案--------------------
C/C++ code
printf("the total salary is %f,and the real salary is %f,and the tax is %f\n",total,salary,tax);//楼主double类型要用%f打印,或者%lf
我的异常网推荐解决方案:软件开发者薪资,http://www..net/other/1391128.html