It just stays in an endless loop, and i though my > statement would end the loop. Any suggestions are welcomes, thank you all in advance for trying to help!
int main()
{
double initialInv, intRate, amtDesired, years, endAmt, begAmt, increase;
cout << "To find out how many years it will take to achieve the investment\nreturn you desire, please input the amount you are investing, the\n";
cout << "yearly interest rate (as an interger), and the amount you wish to achieve.\n";
cin >> initialInv >> intRate >> amtDesired;
years = 1;
cout << left << setw(10) << "Years" << left << setw(18) << "Initial Amount" << left << setw(9) << "End Amount";
endAmt = 0;
if(!cin.good()) // user gave bad input
{
cin.ignore(1000); // dump the bad input
cin.clear(); // reset cin to be in a good state
}
while (endAmt < amtDesired)
{
intRate = intRate / 100;
increase = initialInv * intRate;
endAmt = increase + initialInv;
begAmt = initialInv;
initialInv = endAmt;
years++;
cout << left << setw(10) << years << left << setw(18) << fixed << setprecision(2) << begAmt;
cout << left << setw(9) << fixed << setprecision(2) << endAmt;
}