-3
在我的抵押贷款计划功能(我正在写它在它自己的C文件,然后把它放在一个更大的程序中),它显示每月付款为0美元,因为当我要求的抵押期限时,它跳过问我的意见,只是直接回答。此外,无关,但是有没有办法像别人的“我也有这个问题”这样说,因为有很多类似的程序(mortage有很多问题),或者这是最好的方法吗?我不想混乱网站。抵押贷款计划调试
编辑:现在它说“Segementation故障”我在为抵押的消灭项(24个月)
编辑把24后:现在在说-0.0000支付
int main()
{
double x, m, n, r, p, y =0; //m is monthly payment, x is pow
printf("Enter principal amount now: ");
scanf("%d", &p);
printf("Enter interest rate (0.01 = 1%) now: ");
scanf("%lf", &r);
printf("Enter payment period in months now: ");
scanf("%lf",&n);
printf("Calculating... ");
//m = p [ r(1 + r)^n ]/[ (1 + r)^n - 1]; // mortage formula
x= 1+r;
y = pow(x, n);//call pow function
m= (p*(r*y))/(y-1);
printf("The monthly payment for your mortage is: %lf \n",m); //display mortage monthly payment
}
double pow(double x, double n)
{
//double y =0;
//base=x;
//exp=n;
return(0);
}
'//调用战俘function',实际上是不是你调用一个函数。最好回到你的学习书,因为这是一个非常基本的失败。 – usr2564301
'double pow(double x,double n); //调用pow函数'查找声明vs定义与函数调用。 – tangrs
虽然尚未完成,但为什么它不会等待让我投入抵押期?它等待我之前2的输入。 – Jite