在最后一个printf函数中,以%f的形式输出salary,但是输出结果为0.0000,调试的时候可以看到salary的值是正常的float类型
#include<stdio.h>
int main()
{
int choice;
float work_hours;
float salary;
printf("Enter the number corresponding to hte desired pay rate or action:\n");
printf("1)$8.75/hr\n2)$9.33/hr\n3)$10.00hr\n4)$11.20/hr\n5)quit\n");
scanf("%d %f",&choice,&work_hours);
switch(choice)
{
case 1:
{
salary=work_hours*8.75;
break;
}
case 2:
{
salary=work_hours*9.33;
break;
}
case 3:
{
salary=work_hours*10.00;
break;
}
case 4:
{
salary=work_hours*11.20;
break;
}
case 5:
{
break;
}
}
printf("%5f是你的工资",&salary);
}
```