1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

#include <iostream>
using namespace std;
int main()
{
//declaring all variables
int initial_size; // in lbs.
int num_of_days;
int time_period;
long double f_value;
long double f_1;
long double f_2;
long double count;
time_period == 5; // labeling time period as five days.
count == num_of_days / time_period; // making sure crud grows every five days.
char ans; // response for loop
//intro to program
cout << "Hello, This program will tell you \n" ;
cout <<"how big your green crud population will \n" ;
cout <<"grow in a certain number of days. \n" ;
cout << "\n" ;
//looping program using do_while loop
do
{
//asking user for weight of crud in pounds
cout << "Enter the weight of your green crud in pounds: \n" ;
cin >> initial_size;
cout << "\n";
// asking user to enter the amount of number of days
cout << "Now, enter the number of days your crud population \n" ;
cout << "will grow: \n" ;
cin >> num_of_days;
// code for determining crud size
if ( count <= 1 )
{
cout << "In " << num_of_days ;
cout << " your green crud is " << f_2 << " lbs. \n";
}
else
{
// fibonacci code.
f_value = f_1 + f_2;
f_1 = f_2;
f_2 = f_value;
//outputting
cout << "In " << num_of_days << " days " << " your green crud is " << f_value << " lbs.\n";
cout << "\n" ;
}
//asking user to calculate again
cout <<"Would you like to try a different weight? \n" ;
cout << "( Y for yes anything else for no ) \n" ;
cin >> ans;
}
while ( ans == 'y'  ans == 'Y' );
{
cout << "\n" ;
cout << "Program Terminated. \n" ;
}
return 0;
}
 
I am supposed to do this problem below.
The Fibonacci numbers F(n) are defined as follows F(0) is 1, F(1) is 1,
and F(i+2) = F(1) + F(i+1)
i = 0,1,2,..... In other words,each number is the sum of the previous two numbers. The first few Fibonacci numbers are 1,1,2,3,5, and 8. One place that these numbers occur is as certain population growth rates. If a population has no deaths, then the series shows the size of the population after each time period. It takes an organism two time periods to mature to reproducing age, and then the organism reproduces once every time period. The formula applies most straightforwardly to asexual reproduction at a rate of one offspring per time period.
Assume that the green crud population grows at this rate and has a time period of 5 days. Hence, if a green crud population starts out as 10 pounds of crud, then in five days there is still 10 pounds of crud; in 10 days there is 20 pounds of crud, in 15 days 30 pounds, in 20 days 50 pounds, and so forth. Write a program that takes both the initial size of a green crud population (in pounds) and a number of days as input, and outputs the number of pounds of green crud after that many days. Assume that the population size is the same for four days and increases every fifth day. Your program should allow the user to repeat this calculation
as often as desired.