Find expert answers and community insights on IDNLearn.com. Our experts provide timely and accurate responses to help you navigate any topic or issue with confidence.

/* In a predator-prey simulation, you compute the populations of predators and prey,
using the following equations;
prevn+ 1 = preyn * (1 + A - B * predm)
predm+1 = predn * (1 - C + D à preyn)
preyn+ 1 and predn+ 1 are the just the next preyn and predn respectively.
This is not valid c++
Here, A is the rate at which prey birth exceeds natural death, B is the rate of predation,
C is the rate at which predator deaths exceed births without food,
and D represents predator increase in the presence of food.
Write a program that prompts users for these rates, the initial population sizes,
and the number of periods. Then print the populations for the given number of periods.
As inputs, try A = 0.1, B = C - 0,01, and D = 0.00002 with initial prey and
predator populations of 1,000 and 20.
The following is the sample run using the data above:
Rate at which prey birth exceeds natural death (A): 0.1
Rate of predation (B): 0.01
Rate at which predator deaths exceed births without food (C): 0.01
Predator increase in the presence of food (D): 0.00002
Initial prey population: 1000
Initial predator population: 20
Number of periods: 5
900 20
808 20
724 20
648 21
580 21





. _- Hint for the output
use #include and the following objects to get the output to print in a table format:
fixed
setprecision(O)
setw


In c++


Sagot :

We value your participation in this forum. Keep exploring, asking questions, and sharing your insights with the community. Together, we can find the best solutions. Your search for answers ends at IDNLearn.com. Thank you for visiting, and we hope to assist you again soon.