Question: Edit this code to use pointer type variable #include typedef unsigned long long int ll; // using for unsigned long long int for handling large

Edit this code to use pointer type variable

#include

typedef unsigned long long int ll; // using for unsigned long long int for handling large numbers

using namespace std;

int main()

{

ll population, days;

double increase;

cout << "Enter starting number of organisms: ";

cin >> population;

// to check population less then 2

while (population < 2)

{

cout << "The number should not be less than 2: ";

cin >> population;

}

cout << " Enter the average daily population in percentage : ";

cin >> increase;

// increment should not be less then 0

while (increase < 0)

{

cout << "Please enter a non-negative increase: ";

cin >> increase;

}

cout << " Enter number of days: ";

//enter the number of days

cin >> days;

while (days < 1)

{

cout << "Please enter a number not less than 1: ";

cin >> days;

}

cout << " Day\t\tPopulation";

cout << endl;

// final calculation of increasing population.

for (int i = 1; i <= days; i++)

{

population = population * (1 + increase / 100.0);

cout << i << "\t\t" << population << endl;

}

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!