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
Ber [7]
3 years ago
10

Write a value-returning function that receives an array of integer values and the array size as parameters and returns a count o

f the number of elements that are less than 60.
Computers and Technology
1 answer:
Mrac [35]3 years ago
7 0

Answer:

The c++ function for reversing an array is given. The function is declared void since it returns no value.

void reverse( int arr[], int len )

{

  int temp[len];

  for( int k = 0; k < len; k++ )

  {

      temp[k] = arr[k];

  }

  for( int k = 0, j = len-1; k < len, j>= 0; k++, j-- )

  {

          arr[k] = temp[j];

   }

}

Explanation:

The reverse function uses another array to reverse the elements of the original array.

An integer array is declared, temp[len], having the same length as the input array.

int temp[len];

To begin with, the elements of the input array are copied in the temp array.

for(int k = 0; k < len; k++ )

{

      temp[k] = arr[k];

}

Next, the elements of the input array are given new value.

The temp array, in reverse order, is copied into the input array.

for( int k = 0, j = len-1; k < len, j>= 0; k++, j-- )

{

          arr[k] = temp[j];

}

The above for loop makes use of two variables simultaneously.

While the array, arr is proceeding from first element to the next, the array temp begins with the last element and goes down to the previous element.

Now, the input array, arr, contains the elements in reverse order.

The complete program is given.

#include <iostream>

using namespace std;  

void reverse( int arr[], int len );

void reverse( int arr[], int len )

{

  int temp[len];

 

  for(int k = 0; k < len; k++ )

  {

      temp[k] = arr[k];

  }

 

  for( int k = 0, j = len-1; k < len, j>= 0; k++, j-- )

  {

          arr[k] = temp[j];

  }

 

}

int main()  

{

  int len = 5;    

  int arri[len];    

  for( int l = 0; l < len; l++ )

  {

      arri[l] = l;

  }

 

  reverse( arri, len );    

  return 0;

}

You might be interested in
A computer _________ is a set of self-replicating program instructions that surreptitiously attaches itself to a legitimate exec
k0ka [10]
Virus                    <span> </span>
4 0
4 years ago
Can rank u r guys in rocket leagye
Cerrena [4.2K]
Ha ha ha ha ha ha ha ha
4 0
3 years ago
Which of the following is NOT an example of a font style?
erastovalidia [21]
C. Underline because it is not a kind of font. it is an effect.
3 0
3 years ago
Define computer memory and write it's type ​
DochEvi [55]

Answer:

Computer memory is a generic term for all of the different types of data storage technology that a computer may use, including RAM, ROM, and flash memory. Some types of computer memory are designed to be very fast, meaning that the central processing unit (CPU) can access data stored there very quickly.

8 0
3 years ago
Electronic cover letters are longer than traditional paper cover letters.
8090 [49]

Answer: F

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Type the correct answer in the box.
    7·1 answer
  • Splunk In most production environments, _______ will be used as the source of data input?
    12·1 answer
  • A ________ separates traditional voice telephone transmission from the data transmissions in the equipment located at the custom
    11·1 answer
  • Where would you look to see how much space is available on your c drive?
    8·1 answer
  • ____ is a general term that includes all products of the human mind, including original ideas.
    5·1 answer
  • What invention in the past do you think had a significant impact on our culture/ lifestyle? What do you think will be invented/
    11·1 answer
  • Have you ever tried to learn a new language or do you have friends who've had that experience? What are some of the steps you wo
    10·2 answers
  • Which daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is neede
    14·1 answer
  • 21
    5·1 answer
  • Edhesive 6.8 code practice
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!