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
alisha [4.7K]
3 years ago
12

Write a function all_cats that consumes a comma-separated string of animals and prints whether all of the animals have "cat" in

their name. For example, the string "gerbil,catfish,dog,cat" would return False, but just "cat,catfish" would return True. If the function consumes an empty string, then it returns True. Call this function on a string of animals of your choice and print the result.

Computers and Technology
1 answer:
RoseWind [281]3 years ago
8 0

Answer:

  • Image 1 is for the function defining all_cats():

       (All the explanation is given in comments before each statement)

  • Image 2 has the code for testing the function all_cats()
  • Last image has the output of the code.

You might be interested in
Write and test a function that takes the addresses of three double variables as arguments and that moves the value of the smalle
damaskus [11]

Answer:

#include <bits/stdc++.h>

using namespace std;

// function to swap largest to third, smallest to first and middle to second

void valueSwap(double *a,double *b,double *c)

{

   // variables

  double f,s,t;

 // if value of first is greater than second

  if(*a>=*b)

  {

      // if value of first is greater than third

      if(*a>=*c)

      {

          // swap

          t = *a;

          if(*c>=*b)

          {

              s = *c;

              f = *b;

          }

          else

          {

              //swap

              f = *c;

              s = *b;

          }

      }

      else

      {

          //after all the swap

          f = *b;

          s = *a;

          t = *c;

      }

  }

  else

  {

      // if value of second is greater than third

      if(*b>=*c)

      {

          t = *b;

          if(*c>=*a)

          {

              // swap

              s = *c;

              f = *a;

          }

          else

          {

              //swap

              f = *c;

              s = *a;

          }

      }

      else

      {

          // after all the swap

          t = *c;

          s = *b;

          f = *a;

      }

  }

 

 // final values

  *a = f;

  *b = s;

  *c = t;

 

}

// main function

int main()

{

  // variables

  double n1,n2,n3;

  // ask to enter first number

  cout<<"Enter the first number:";

  // read first number

  cin>>n1;

  // ask to enter second number

  cout<<"Enter the second number:";

  // read second number

  cin>>n2;

  // ask to enter third number

  cout<<"Enter the third number:";

  // read third number

  cin>>n3;

  // call the function to swap values with address parameter

  valueSwap(&n1,&n2,&n3);

  // print number after swapping

  cout<<"Number after swapping: "<<n1<<" "<<n2<<" "<<n3<<endl;

  return 0;

}

Explanation:

Ask user to enter 3 double numbers.Then read 3 numbers from user and assign them  to variables "n1","n2" and "n3" respectively.Call the function valueSwap() which take address of all three variables as argument and then assign the largest value among the three to variable "n3" and smallest to "n1" and middle to variable "n2". Print the values after swapping.

Output:

Enter the first number:20                                                                                                  

Enter the second number:30                                                                                                

Enter the third number:10                                                                                                  

Number after swapping: 10 20 30

7 0
4 years ago
Select the correct answers
Mashutka [201]

Answer:

Use a mixture of External and Internal Links....

Explanation:

8 0
3 years ago
Which part of the computer coordinates all computer operations and performs arithmetic and logical operations on data
allochka39001 [22]

Answer:

A central processing unit (CPU) is the electronic circuitry within a computer that carries out the instructions of a computer program by performing the basic arithmetic, logical, control and input/output (I/O) operations specified by the instructions. The term has been used in the computer industry at least since the early 1960s.

5 0
3 years ago
Instant messaging allows text only <br> a. True <br> b. False
xenn [34]
False!                           

There are other things you can do like send pictures and etc.
6 0
4 years ago
Which of the following statements about light-emitting diodes is correct?
defon

The correct answer if B

4 0
3 years ago
Other questions:
  • Which tool will be useful in darkening a subject’s hair color in a photograph? A.Dodge tool B.Burn tool C.Patch tool D.Blur tool
    5·2 answers
  • Which statement below is inaccurate? a. Web 2.0 is a simple static website without any interaction with its users b. Web 2.0 bri
    5·1 answer
  • Rows within a spreadsheet are identified by:
    8·1 answer
  • Design two subclasses of Employee…SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An ho
    12·1 answer
  • Which column and row references are updated when you copy the formula: =F$5+12?
    14·1 answer
  • Write a C function which mimics the behavior of the assembly language function below. Note that this time, the assembly language
    10·1 answer
  • Which one is not considered part of the cinematography team?
    7·2 answers
  • How does design influence the product's function?
    5·1 answer
  • Tightly.
    5·1 answer
  • a) In an office, it is required to take hundreds of copies of the same type written document. Which traditional method of docume
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!