So I am supposed to write a code where the user inputs the population and growth rate in percentage/year of two towns A and B. I need to find out how many years it would take town A to have a greater population than town B. I am running my code and inputting (5000 4) for town A and (8000 2) for town B but the program stops. Any idea why?
#include <iostream>
using namespace std;
int main()
{
double popA, popB;
int growthA, growthB, years = 0;
cout << "Enter the population and growth rate of A: ";
cin >> popA >> growthA;
cout << "Enter the population and growth rate of B: ";
cin >> popB >> growthB;
cout << "After " << years << " years the population of A will be greater than the population of B." << endl;
cout << "The population of A is: " << popA << endl;
cout << "The population of B is: " << popB << endl;