0

Hello all, I am attempting to learn C++ on my own. I am going through the book C++ Primer by Steven Prada, in case anyone has the book. At the end of every chapter, they give programming problems and I am having trouble with one of the problems. Essentially the problem ask to create a program that calculates the value of two women's investments. One that receives standard interest and one that receives compound interest, and to determine when the value of the investment receiving 5% compound interest exceeds the value of the investment receiving 10% standard interest. Here is my code.

```
#include <iostream>
int main()
{
using namespace std;
int Cleo = 100;
int Daphne = 100;
int i = 0;
int j = 0;
int count = 0;
for (i = Cleo, j = Daphne; j > i; i++, j++)
{
j += (.1 * 100);
i += (.05 * i);
++count;
}
cout << "In " <<count<< " years, Cleo's"
<< "investment exceeds Daphne's investment.\n";
cout << "Cleo's investment is worth "<< Cleo << " , while"
<< " Daphne's investment is worth " << Daphne << endl;
return 0;
}
```