/* * File: L3-worldPop.cpp * Purpose: * Estimate the world population growth in a year and * also per day. * Given that on January 1, 2008 the world's population was * estimated at 6,650,000,000 and the estimated growth is * at the rate of +1.14% */ #include using namespace std; int main() { double population = 6650000000.0; // double because # is so big double growthRate = 1.14 / 100.0; int year = 2008; cout << "World population on January 1, 2008 is " << population << endl; for (int step = 1; step <= 6; step++) { year = year + 1; population = population + population * growthRate; cout << "By Jan. 1, " << year << ", it will be " << population << endl; } return 0; }