I am unsure what is wrong with my code, the formula i need to have is x*(1+(r/100))^Y where x is initial investment and r is interest rate and y is years
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int inInvest;
int intRate;
int numQuarter;
cout<<"Enter initial investment (dollars): ";
cin>>inInvest;
cout<<"Enter interest rate per year (percentage): ";
cin>>intRate;
intRate = (intRate/100.0);
cout<<"Enter number of quarters: ";
cin>>numQuarter;
cout<<" "<<endl;
double years = (numQuarter/4.0);
You are declaring intRate as an integer data type, but the line intRate = (intRate/100.0) won't work that way.
Let's say the interest is 6%, so cin >> intRate sets intRate to 6. Then, you have intRate = (intRate/100.0) = 6/100.0 = 0.06. But since intRate is int type, this evaluates to zero instead. I'd make intRate a float to make everything work out well.
There may be other issues, but that's the first one I noticed.