Hellp programmers! I'm trying to create a program that displays the impact of changing the rate of compound intrest using the historical example of Manhattan's aquisition as an example. The code is below:
int main()
{
double amount=0; //amount on deposit at the end of each year
double principal=24.00; //initialize principal
//display headers
cout << "Legend has it that in 1626, Peter Minuit purchased"<<endl;
cout << "Manhattan Island for $24.00 in a barter."<<endl;
cout << "\nDid he make a good investment?"<<endl;
cout << "Below is a table of his return on the investment"<<endl;
cout << "in 2013 (387 years' difference) with intrest"<<endl;
cout << "rates varying from five to ten percent per year."<<endl;
cout << "\nCheck it out for yourself.\n\n"<<endl;
cout << "Rate" << setw(40) << "Return on Investment ($)" << endl;
//set floating point number format
cout << fixed << setprecision(2);
//calculate amount
for (float rate=.5; .5<=.10;rate+=.1)
{
//calculate new amount for specified year
amount=principal*pow(1.0+rate,387);
cout << setw(4) << rate << setw(40) << amount << endl;
}
return 0;
}
However, when I run it, I get the following:
Legend has it that in 1626, Peter Minuit purchased
Manhattan Island for $24.00 in a barter.
Did he make a good investment?
Below is a table of his return on the investment
in 2013 (387 years' difference) with intrest
rates varying from five to ten percent per year.
Check it out for yourself.
Rate Return on Investment ($)
This means that the program dosn't get into the loop that varies the intrest rate from five to ten percent per year. Why isn't the loop being activated?