Hey guys, I'm stuck again.
The program is supposed to get the estimated population after n years using the equation P + (BP/100)-(DP/100) and the growth rate using B-D.
Here is what I have so far, but I can see I'm going to be getting stuck.
How can I set my parameters for estimatedPopulation to grab the values from growthRate in addition to the current population and number of years?
#include <iostream>
#include <string>
using namespace std ;
int main()
{
int x ;
int population ;
population = estimatedPopulation(growthRate()) ;
cout << "Estimated population after " << n << " years: " << population << endl ;
return 0 ;
}
int growthRate ()
{
int birthRate ;
int deathRate ;
int growthRate ;
cout << "Enter the birth and death rates per year, seperated by a space: " << flush ;
cin >> birthRate, deathRate ;
if ( ( birthRate < 0 ) || ( deathRate < 0 ) )
{
cout << "You can't have negative death/birth rates, dumbie!" << endl ;
return 0 ;
}
growthRate = birthRate - deathRate ;
return growthRate ;
}
int estimatedPopulation ()
{
int cPopulation ;
int population ;
int n ;
cout << "Enter the current population: " << flush ;
cin >> cPopulation ;
cout << "Enter the number of years to calculate: " << flush ;
cin >> n ;
}