Apr 2, 2015 at 6:09am UTC
On line 27, the second use of timesCompounded I am receiving a few errors preventing me from compiling. Error C2146 and C2059 missing a ; and ). I do not see where I am missing either one of those. I have removed the offending timesCompounded and the errors go away only to return when I put it back. I do not understand what the problem is.
Thank you for any direction you can give me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double interestRate;
int timesCompounded;
double principal;
double interestEarned;
double newBalance;
cout << "What is the interest rate? (Enter as X.XX)" << endl;
cin >> interestRate;
// convert interestRate into a decimal
interestRate = (interestRate / 100);
cout << "How many times is interest compounded? " << endl;
cin >> timesCompounded;
cout << "What is the principal? " << endl;
cin >> principal;
// Compute new balance
newBalance = (principal * (1 + (interestRate / timesCompounded)) timesCompounded);
}
Last edited on Apr 2, 2015 at 6:10am UTC
Apr 2, 2015 at 7:02am UTC
newBalance = (principal * (1 + (interestRate / timesCompounded)) timesCompounded);
Specifically here
)) timesCompounded);
timesCompounded is just chilling there. You never said whether to plus it, divide it, multiply it, etc.
Right now, you've only said. Principal times interestRate divided by timesCompounded +1... and what about the last timesCompounded?
Apr 3, 2015 at 5:44am UTC
Thank you. Algebraeicly it looked correct to me.