Im trying to output the population increase for a population. the problem is my for loop doesn't increment or add correctly. here is a sample output. i made it easy with no death rate and a population of 100 to easily calculate the increase in my head.
Starting Population: 100
Annual Birth Rate Percentage: 100
Birth as a percentage is: 1
Annual Death Rate Percentage: 0
death as a percentage is: 0
Number of years to calculate: 5
Year 1 population: 100
Year 2 population: 300
Year 3 population: 500
Year 4 population: 700
Year 5 population: 900
here is the for loop, where the problem is. the rest of the program is just asking for user input but i will include it if asked.
double population = startSize;
for (int i = 1; i <= years; i++)
{
cout << "Year " << i << " population: " << population << endl;
population += (startSize * (1 + annualBirth) * (1 - annualDeath));
}