We want to determine what the population of Neverland will be a certain number of years from now, assuming that

Neverland has a steady population growth of 12% per year. You have to write a C++ function population to

calculate this. The function should be a value-returning function of type int and is called in the main function as

follows:

answer = population(popul, nrYears);

where popul indicates the population of Neverland in 2007, and nrYears indicates the number of years from now

(for example 9, if we are interested in the population in 2016). Thus the function should determine what the

population of Neverland will be in 2007 + nrYears.

Assume

• that answer and nrYears have been declared as int,

• that popul has been declared as float, and

• that values have been assigned to both popul and nrYears in the main function.

Write ONLY the complete function population. Use a for loop.

I've tried this, i dont know if is wright.

population(popul, nrYears) { for(int i = 1, i <= nrYears, i++) { total += popul; total++; cout<<"In "<< i << "the number of population will be "<< total << endl; } }