关于pow函数的问题
本帖最后由 1613551 于 2022-10-12 10:06 编辑有无大佬知道第24行编译失败,是哪里错了?
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
float price, area, yir, mir; //单价,面积,年利率、月利率
float interest, loan; //利息,贷款总额
float ave_repay, down_payment;//月均还款、首期付款
float total_price, total_repay; //房贷总额、还款总额
int ratio, time; //按揭成数、按揭年数
printf("请输入单位(元/平方):"); // 6000
scanf("%f", &price);
printf("请输入面积:"); // 120
scanf("%f", &area);
printf("请输入按揭成数"); // 20
scanf("%f", &ratio);
printf("请输入按揭年数:"); // 20
scanf("%f", &time);
printf("请输入当前基准年利率:"); // 5.4
scanf("%f", &yir);
total_price = price * area;
ave_repay=loan*(mir*(pow((1+mir),(time*12)))/(pow((1+mir),(time*12))-1);
down_payment=total_price-loan;
loan=total_price*(ratio*0.7);
interest=(time*12)*ave_repay-loan;
total_repay=interest+loan;
mir=(yir/100)/12;
printf("============报告结果============");
printf("房贷总额:%.2f元\n",total_price);
printf("首期付款:%.2f元\n",down_payment);
printf("贷款总额:%.2f元\n",loan);
printf("还贷总额:%.2f元\n",total_repay);
printf("支付利息:%.2f元\n",interest);
printf("月均还款:%.2f元\n",ave_repay);
system("pause");
return 0;
} 这是原题目 尾部少了一层括号
ave_repay = loan * (mir*(pow((1+mir),(time*12)))/(pow((1+mir),(time*12))-1)); yb yb 领个鱼币
页:
[1]