I am new to programming and I have a hard time writing some programs. I am currently stuck at this point. I will post the code that I currently have.
This program is designed to analyze the growth of two cities. Each city has a starting population and annual growth rate. The smaller city has the larger growth rate (required). Show the comparative populations of each city year by year until the smaller city has grown larger than the bigger city.
As an example, Dogville has a population of 5000 growing at 20% annually while Cattown has a population of 7000 growing at 10% annually. The projected populations are:
Year Dogville Cattown
1 6000 7700
2 7200 8470
3 8640 9317
4 10368 10249
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int stpop = 0;
int btpop = 0;
double strate =0;
double btrate =0;
do
{
cout << "Enter the starting population for the small town:" << endl;
cin >> stpop;
cout << "Enter the starting population for the big town:" << endl;
cin>> btpop;
}
while (stpop > btpop);
do
{
cout << "Enter the growth rate for the small town" << endl;
cin >> strate;
cout << "Enter the growth rate for the big town" << endl;
cin >> btrate;
}
while (strate < btrate);