#include <iostream>
usingnamespace std;
struct Population
{
int population, birth, death;
double birthRate, deathRate;
}
void getRate(Population &geo);
void showRate (Population);
int main ()
{
Population geo;
getRate(geo);
showRate(geo);
cout << "\n\n";
}
void getRate(Population &geo)
{
cout << "Enter the number of births: ";
cin >> geo.birth;
if (geo.birth < 0)
{
geo.birth = 0;
}
cout << "\nEnter the number of deaths: ";
cin >> geo.death;
if (geo.death < 0)
{
geo.death = 0;
}
cout << "\nEnter the number of population: ";
cin >> geo.population;
if (geo.population < 2)
{
geo.population = 2;
}
geo.birthRate = geo.birth/geo.population;
geo.deathRate = geo.death/geo.population;
}
void showRate(Population geo)
{
cout << "In a population of " << geo.population << ", there are " <<
geo.birth << " births in a rate of " << geo.birthRate <<
"\n and the number of deaths are " << geo.death << ", in a rate of "
<< geo.deathRate;
}