I was trying to do the following problem but I keep getting the error of invalid operands of type double and double to binary operator. I've switched everything I can think of with my super-limited abilities and still can't fix the error. Can anyone help me? (I posted the question at the very bottom that I am doing the code for). Thank you very much to anyone who can help
*edit* I noticed when i switch the double with int the code works but i need to be able to use decimal points.the same error happens to me when i use float
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
double principal1;
double rate;
double T;
double amount;
cout << "Enter principal1: ";
cin >> principal1;
cout << "Enter rate: ";
cin >> rate;
cout << "Enter times compounded annually: ";
cin >> T;
amount=(principal1)*((1+(rate/T))^T);
cout << "The total amount is : " << amount << endl;
return 0;
}
Assuming there are no deposits other than the original investment, the balance in a savings account after one year may be calculated as
Amount = Principal*(1 + Rate/T)^ T
Principal is the balance in the savings account, Rate is the interest rate, and T is the number of times the interest is compounded during a year (T is 4 if the interest is compounded quarterly).
Write a program that asks for the principal, the interest rate, and the number of times the interest is compounded. It should display a report similar to
Programming Challenges 145
Interest Rate:4.25
Times Compounded: 4
Principal:1000
Interest:43.34
Amount in Savings:1043.34