A farmer has a bunny farm. He has cage capacity for a limited number of bunnies. A pair of adult bunnies will give birth to 2 bunnies (1 male and 1 female) at the end of every three months. A bunny is an adult when he or she reaches the age of 4 months. (i.e. 1st pair at age 3 months give birth to1 male and 1 female at the end of the 4th month). For example:
Number of months Number of bunnies
0 2
3 4
6 8
9 16
12 32
and so on……….
Write a complete C++ program to do the following:
1. Prompt the user to enter the total capacity of the cage.
2. Determine when the farmer will have to separate the bunnies in order to prevent the birth of any more.
3. Convert the above time in months to years and months.
4. Determine the number of bunnies that could still be accommodated in the cage when the bunnies were separated.
5. Prompt the user to input a time (in months) to check how many bunnies are present at a given time.
6. Print your results as indicated on the next page.
HelmsK85 0 Newbie Poster
Salem 5,199 Posting Sage
HelmsK85 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
HelmsK85 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
HelmsK85 0 Newbie Poster
HelmsK85 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
HelmsK85 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
HelmsK85 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Dave Sinkula 2,398 long time no c Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.