1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Xelga [282]
3 years ago
6

Write a program that will predict the size of a population of organisms. The program // should ask the user for the starting num

ber of organisms, their average daily population // increase (as a percentage of the current population), and the number of days they will // multiply. A loop should display the size of the population for each day.
Computers and Technology
1 answer:
nordsb [41]3 years ago
7 0

Answer:

Following are the program in the C++ Programming Language:

#include <iostream>

using namespace std;

int main() {

 float starting, average;

 int num;

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

 while(!(std::cin >> starting)|| starting < 2){

   std::cout<<"starting number must be greater than 2\n";

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

   std::cin.clear();

   std::cin.ignore(123,'\n');

 }

 std::cout <<"Enter the average of daily population is increase %: ";

 while(!(std::cin >> average)|| average < 0){

   std::cout<<"Average must be greater than 0\n Enter average";

   std::cin.clear();

   std::cin.ignore(123,'\n');

 }

   average *= .01;

 std::cout <<"Enter the number of days: ";

 while(!(std::cin >> num)|| num < 1){

   std::cout<<"Number of days no be less than 1\n" <<"Enterthe number of days\n";

   std::cin.clear();

   std::cin.ignore(123,'\n');

 }

 for(int i=0; i<num; i++){

   std::cout<<"population size of day"<<(i+1);

   std::cout<<": "<<starting<<std::endl;

   starting +=(starting*average);

 }

 return 0;

}

<u>Output</u>:

Enter starting number of the organisms: 4

Enter the average of daily population is increase %: 5

Enter the number of days: 4

population size of day1: 4

population size of day2: 4.2

population size of day3: 4.41

population size of day4: 4.6305

Explanation:

Here, we define header file "<iostream>" and namespace "std".

  • Then, we define the main() inside it, we set two float data type variable i.e., "starting", "average" and set an integer data type variable i.e., "num".
  • Then, we print a message and after that, we set the while loop for get input from the user in variable "starting" and pass the condition inside loop we print message than clear cin and ignore 123 then, we again do this to get  input from user in variable "average".
  • Then, we set the for loop and pass the condition inside the loop print the size of the day then print the value of "starting" after that we multiply.
  • Finally, we return 0 and close the main function.
You might be interested in
How do you implement instruction level parallelism
netineya [11]

Answer:

To obtain substantial performance enhancements, we must exploit ILP across multiple basic blocks.

Explanation:

8 0
3 years ago
Jenny wants to create an animated short video to add to her website. Which software will she use to create this animated video?
denis23 [38]
Adobe Spark or Adobe Premier.
6 0
3 years ago
5. What is a domain name used for?​
Mnenie [13.5K]

<u>Answer:</u>

Domain names serve to identify Internet resources, such as computers, networks, and services, with a text-based label that is easier to memorize than the numerical addresses used in the Internet protocols. A domain name may represent entire collections of such resources or individual instances.

<u />

<u>Explanation:</u>

*Hope this helps*

7 0
3 years ago
Niall is revising a history assignment using a word processor on a Windows computer. He wants to copy a section from an earlier
Zarrin [17]

Answer:Ctrl + V

Explanation:

7 0
2 years ago
Which is a safe Internet behavior?
Westkost [7]
Don’t give out personal information
7 0
3 years ago
Other questions:
  • Cell phone producers charge a _____, which consumers pay to buy the phones. profit production cost price
    12·1 answer
  • Cyberterrorism is the use of terrorism to attack (Points : 1) public libraries. computer based networks. government spy networks
    15·1 answer
  • Suppose company A wants to develop a program that duplicates the functionality of a programm by company B. Describe how company
    8·1 answer
  • What are the principal cybersecurity threats, both internal and external, and the principal safeguards that have been developed
    13·1 answer
  • It chapter 2 pennywise
    13·1 answer
  • What X coordinate does the center of a game begin at?
    9·1 answer
  • Do you know some website that can make a questionnaire? And I can use the link then put up on the social media so that everyone
    7·2 answers
  • Guess The Song:
    9·1 answer
  • Explain the bad effect and good effect of mobile phone and internet.<br>​
    15·2 answers
  • (20 points). Some matrixes have very special patterns, for example, in the following matrix, the numbers in the first row are eq
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!