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
KIM [24]
3 years ago
8

-------- C++ ------

Computers and Technology
1 answer:
Nataly_w [17]3 years ago
4 0

Answer:

The function testInOrder is as follows:

bool testInOrder(){

bool chk= false;

   int n1, n2, n3;

   cin>>n1;cin>> n2; cin>> n3;

   if(n2>=n1 && n3 >= n2){chk = true;}

   bool result = inOrder(n1,n2,n3);

   if(result == chk){ return true;}

   else{return false;}

}

The function testmax is as follows:

bool testmax(){

   bool chk = false;

   int n1, n2;

   cin>>n1; cin>>n2;

   int mx = n1;    

   if(n2>=n1){        mx = n2;    }

   int returnMax = max(n1,n2);

   if(returnMax == mx){        chk = true;            }

   return chk;

}

The prediction program is as follows:

#include <iostream>

using namespace std;

int main(){

   int startSize,numDays;

   float aveInc;

   cout<<"Start Size: ";

   cin>>startSize;

   while(startSize<2){

       cout<<"The starting number of organisms must be at least 2.";

       cin>>startSize;    }

   cout<<"Average Daily Increase: ";

   cin>>aveInc;

   while(aveInc<1){

       cout<<"The average daily population increase must be a positive value.";

       cin>>aveInc;    }

   cout<<"Number of days: ";

   cin>>numDays;

   while(numDays<1){

       cout<<"The number of days must be at least 1.";

       cin>>numDays;    }

   for(int i = 0;i<numDays;i++){        startSize*=(1 + aveInc);    }

   cout<<"Predicted Size: "<<startSize;

}

Explanation:

<u>testInOrder</u>

This defines the function

bool testInOrder(){

bool chk= false;

This declares all three variales

   int n1, n2, n3;

This gets input for the three variables

   cin>>n1; cin>>n2; cin>>n3;

This correctly check if the numbers are in order, the result is saved in chk

   if(n2>=n1 && n3 >= n2){chk = true;}

This gets the result from inOrder(), the result is saved in <em>result</em>

   bool result = inOrder(n1,n2,n3);

If result and chk are the same, then inOrder() is correct

   if(result == chk){ return true;}

If otherwise, then inOrder() is false

   else{return false;}

<u>testmax</u>

This defines the function

bool testmax(){

This initializes the returned value to false

   bool chk = false;

This declares the two inputs as integer

   int n1, n2;

This gets input for the two numbers

   cin>>n1; cin>>n2;

This initializes the max of both to n1

   int mx = n1;    

This correctly calculates the max of n1 and n2

<em>    if(n2>=n1){        mx = n2;    }</em>

This gets the returned value from the max() function

   int returnMax = max(n1,n2);

If returnMax and max are the same, then max() is correct

<em>    if(returnMax == mx){        chk = true;            }</em>

<em>    return chk;</em>

}

<u>Prediction program</u>

This declares all necessary variables

   int startSize,numDays;  float aveInc;

This gets input for start size

   cout<<"Start Size: ";    cin>>startSize;

The loop is repeated until the user enters valid input (>=2) for startSize

<em>    while(startSize<2){</em>

<em>        cout<<"The starting number of organisms must be at least 2.";</em>

<em>        cin>>startSize;    }</em>

This gets input for average increase

   cout<<"Average Daily Increase: ";    cin>>aveInc;

The loop is repeated until the user enters valid input (>=1) for aveInc

<em>    while(aveInc<1){</em>

<em>        cout<<"The average daily population increase must be a positive value.";</em>

<em>        cin>>aveInc;    }</em>

This gets input for the number of days

   cout<<"Number of days: ";    cin>>numDays;

The loop is repeated until the user enters valid input (>=1) for numDays

<em>    while(numDays<1){</em>

<em>        cout<<"The number of days must be at least 1.";</em>

<em>        cin>>numDays;    }</em>

The following loop calculates the predicted size at the end of numDays days

<em>    for(int i = 0;i<numDays;i++){        startSize*=(1 + aveInc);    }</em>

This prints the predicted size

   cout<<"Predicted Size: "<<startSize;

You might be interested in
According to the video, what types of education are useful for Database Administrators? Check all that apply.
LUCKY_DIMON [66]

Answer:

college degrees and certification.

Explanation

7 0
3 years ago
Read 2 more answers
Tsunami warning systems that utilize satellite technology to send an alarm have recently been developed and installed. these sys
guapka [62]
The answer that would best complete the statement above would be option A. Tsunami warning systems that utilize satellite technology to send an alarm have recently been developed and installed and these systems are one example of how <span>technology and communication networks can impact global issues. Hope this helps.</span>
4 0
3 years ago
Respond to the following in 2-5 paragraphs. Give an example of how you can demonstrate active listening.
nadezda [96]
Hey my name is ..... and this do the thesis
8 0
3 years ago
In codd's model of a relational database, data is stored in a(n) _____, which maintains information about a(
Dmitry [639]
<span>Which is not a component of a database that describes how data is stored?</span>
5 0
4 years ago
Martina is responsible for the installation and maintenance of both hardware and software that make up her company’s network. Sh
natali 33 [55]

Answer:

The answer is "network administrator"

Explanation:

A network manager is liable for the deployment, maintenance, and upgrade to any software or hardware required to operate a computer system effectively, In this post, Martina works as follows:  

  • She can be extended into a local area, wide area network, the network and web services via the IT or device network.
  • She addresses issues that occur in everyday usage and work on long-term initiatives like as information backup or network maintenance.
5 0
4 years ago
Other questions:
  • Think about your favorite technology item - phone, game, smartTV, etc. - Write about how your favorite technology item has impac
    7·1 answer
  • Who are some of my emails not all deleting on my android i have to use my laptop to see them to delete them?
    12·2 answers
  • Which would be the best reason to consider using plain tables instead of shaded tables in a document?
    6·2 answers
  • Explain Software licensing
    12·1 answer
  • Do you know Aztekium Bot?
    10·2 answers
  • The documents created in ms-excel is call what?​
    11·2 answers
  • What is virtualization?
    11·2 answers
  • WILL MARK BRAINILY!!
    9·2 answers
  • Write an expression whose value is the concatenation of the three strigs name1, name2, and name3, separated by commas
    9·1 answer
  • WILL GIVE BRAINLIEST!!! Danielle is warehouse supervisor for a large shipping company. Most shipments need to leave the warehous
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!