新手求助,购票金额为什么为0,这种方法写错在哪里
double calculate_price(i){
double money;
if(i > 0 && i < 30)
{
money = 50 * i;
//printf("购票金额为: %lf \n",money);
}
else
{
money = (50 * i) - (i*2);
//printf("购票金额为: %lf \n",money);
}
return 0;
}
int main()
{
int a;
int price;
printf("请输入购买的票数:\n");
scanf("%d", &a);
//calculate_price(a);
price = calculate_price(a);
printf("购票金额为: %d \n",price);
return 0;
}
/*
variable 'money' set but not used [-Wunused-but-set-variable]|
*/