接收错误“没有用于调用pow(双)的匹配函数” [英] Receiving error "no matching function for call to pow(double)"
问题描述
我正在制作一个代码来计算储蓄帐户的利息。我把我所有的变量列为Double。我编译它之前写的cout提示在底部,现在我的代码完成,它将无法编译。它给我一个错误。我试图混淆括号的数量,但没有什么帮助。这是我的代码
I'm making a code that will calculate interest on a savings account. I listed all my variables as Double. I compiled it before writing the cout prompts at the bottom, and now that my code is finished, it won't compile. It gives me an error. I tried messing with the amount of parentheses, but nothing helped. Here is my code
FinalBalanceDaily = StartingPrinciple*(pow(1+((SimpInt/100)/365),(365*T)));
FinalBalanceMonthly = StartingPrinciple*(pow(1+((SimpInt/100)/12),(12*T)));
这是错误讯息。
:55:错误:没有匹配的函数调用âpow(双)â
:55: error: no matching function for call to âpow(double)â
然后它给出了注释。事实是,这两行在53和54行,55使用exp函数。
and then it gives notes. The thing is, those two lines are on lines 53 and 54, 55 uses the exp function.
FinalBalanceCont = StartingPrinciple*(exp((SimpInt/100)*T));
EffectiveSimpInt1=(exp(SimpInt*T)-1)/T;
EffectiveSimpInt2=((pow(1+(SimpInt/365),(365*T)))-1)/T;
EffectiveSimpInt3=(pow(1+(SimpInt/12),(12*T))-1)/T;
这些是使用pow()函数的行
These are the lines that use the pow() function
推荐答案
std :: pow()需要两个参数,但你只需要一个
std::pow() need two parameters, but you just give one
double x = 1 + (SimpInt / 100) / 12;
double y = 12 * T;
FinalBalanceMonthly = StartingPrinciple * pow(x, y);
顺便说一下,我认为你把你的()放在错误的地方
By the way, I think that you put your "()" on the wrong place
这篇关于接收错误“没有用于调用pow(双)的匹配函数”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!