I am currently trying to write a code in which I will have information displayed in two different columns. The first column will be the population in thousands, ( going from 10 to 25), while the second column will be the flowrate associated with the corresponding number of people. I'm having trouble incorporating a function of the form Q = 3.86 sqrtP (1-0.01sqrtP) where P is the population in thousands. Any help or advice would be useful. Thank you.
#include <cmath>
// function of the form Q = 3.86 sqrtP (1-0.01sqrtP) where P is the population in thousands.
double Q( double population_in_thousands )
{
constdouble sqrt_p = std::sqrt(population_in_thousands) ;
return 3.86 * sqrt_p * ( 1.0 - 0.01*sqrt_p ) ;
}
Thank you. I have implemented that piece of code into my existing one. I am now having trouble figuring out how to place the return value of the formula into the flowrate column. Here is an updated look at the code I have so far.