Math Power function

Dear Group Members

I am new to c++. I am stuck at this code.
------------------------------------------------------------------------------
# include <iostream>
# include <cmath>
using namespace std;

class FixedDeposit
{
private:
double principle,rate,amount;
int periods;

public:
void setData();
void getAmount();
};
void FixedDeposit::setData()
{
cout << "Enter Amount to be Invested " <<endl;
cin >> principle;
cout << "No of periods in Year " <<endl;
cin >> periods;
cout << "Rate of Interest "<<endl;
cin>> rate;
}
void FixedDeposit::getAmount()
{
amount = principle*((pow(1+(rate/100)),periods));
cout << "You get " <<amount <<endl;

}
int main()
{
FixedDeposit F;
F.setData();
F.getAmount();
}
-----------------------------------------------

Following are errors and warning. Where I am going wrong.Pl Explain

no matching function for call to `pow(double)
candidates are: double pow(double, double)
long double std::pow(long double, int)
float std::pow(float, int)
long double std::pow(long double, long double)
Your parentheses are wrong, you need something like this:
amount = principle*(pow((1+(rate/100)),periods));
After that, I compiled it successfully.

Happy coding!
Dear bl4ckb3rry ,

Oh no, How much I tried for variables but I didn't think of parentheses.

Thank you very much.


Regards
Topic archived. No new replies allowed.