#include <cstdlib>
#include <iostream>
#include <cmath>
double A; //Amount;
double R; // Rate;
double T; //Time;
double Total;
usingnamespace std;
int main(int argc, char *argv[])
{
//1. Ask the user for the original amount of money, the interest rate and the time.
cout << "What was the origional amount of money in the bank?" << endl;
cin >> A;
cout << "What is your current interest rate?" << endl;
cin >> R;
cout << "What is the rate of years?" << endl;
cin >> T;
//2. Calculate the amount of money you will have if the original amount of money, P, is earning interest at r% for t years (compounded annually), the amount of money, A, will be:
//A = P(1 + r/100)^t ... in other words >> Total = Amount(1 + Rate/100)^Time
Total = A*(1 + R/100)^T
//3. The output should look like this:
//After ____ years at interest rate ____%, $____ will become $_______.
cout << "After T years at interest rate R %, $ A will become $ Total ." endl;
^^^^^^^^^^^this line is giving me probems ^^^^^^^^^^^^^^^^
1 2 3 4 5 6 7 8 9
// cout << "After" << T << "years at interest rate" << R << "%, $" << A << " will become $" << Total << "." << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
If you have to comment explaining what the variable names mean... why don't you just give them descriptive names? Why not just name them Amount, Rate, Time instead of A, R, T?