(World Population Growth) World population has grown considerably over the centuries.
Continued growth could eventually challenge the limits of breathable air, drinkable water, arable cropland and other limited resources.
There is evidence that growth has been slowing in recent years and that world population could peak some time this century, then start to decline. For this exercise, research world population growth issues online. Be sure to investigate various viewpoints. Get estimates for the current world population and its growth rate (the percentage by which it is likely to increase this year).
Write a program that calculates world population growth each year for the next 75 years, using the simplifying assumption that the current growth rate will stay constant. Print the results in a table. The first column should display the year from year 1 to year 75. The second column should display the anticipated world population at the end of that year.
The third column should display the numerical increase in the world population that would occur that year. Using your results, determine the year in which the population would be double what it is today, if this year’s growth rate were to persist.
#include < iostream>
#include < iomanip>
using namespace std;
int main()
{
float pop = 7000000000;
double rate = 0. 01;
float increase = 0;
int x = 1;
cout << "Year\tPopulation\tIncrease" << endl;
for( int y = 2012; y <= 2087; y++ )
{
cout << fixed << setprecision(0) << y << "\t" << pop << "\t" << increase << endl;
increase = pop * rate;
pop += increase;
if ( pop > 14000000000 )
{
while( x > 0 )
{
cout << "Population doubled at end of " << y << endl;
x‐‐;
}
}
}/
/for pause
system("PAUSE") ;
return 0;
}
Continued growth could eventually challenge the limits of breathable air, drinkable water, arable cropland and other limited resources.
There is evidence that growth has been slowing in recent years and that world population could peak some time this century, then start to decline. For this exercise, research world population growth issues online. Be sure to investigate various viewpoints. Get estimates for the current world population and its growth rate (the percentage by which it is likely to increase this year).
Write a program that calculates world population growth each year for the next 75 years, using the simplifying assumption that the current growth rate will stay constant. Print the results in a table. The first column should display the year from year 1 to year 75. The second column should display the anticipated world population at the end of that year.
The third column should display the numerical increase in the world population that would occur that year. Using your results, determine the year in which the population would be double what it is today, if this year’s growth rate were to persist.
Solution:
#include < iostream>
#include < iomanip>
using namespace std;
int main()
{
float pop = 7000000000;
double rate = 0. 01;
float increase = 0;
int x = 1;
cout << "Year\tPopulation\tIncrease" << endl;
for( int y = 2012; y <= 2087; y++ )
{
cout << fixed << setprecision(0) << y << "\t" << pop << "\t" << increase << endl;
increase = pop * rate;
pop += increase;
if ( pop > 14000000000 )
{
while( x > 0 )
{
cout << "Population doubled at end of " << y << endl;
x‐‐;
}
}
}/
/for pause
system("PAUSE") ;
return 0;
}
Post A Comment:
0 comments: