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
Anna007 [38]
3 years ago
9

Create a function names minElement() that takes an array of numbers as a paaramter and returns the min value of the array. The a

rray may not be modified by the function. The array method .sort() may not be used. The function must loop through the array
Computers and Technology
1 answer:
Vika [28.1K]3 years ago
8 0

Answer:

#include<iostream>

using namespace std;

//create the function

int minElement(int arr[],int n){

   int minimum = arr[0];  //store the first value of array

   //for loop for iterate the each element

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

       if(arr[i]<minimum){   //compare

           minimum=arr[i];

       }

   }

   return minimum;

}

int main(){

   int arr[]={4,1,7,9,2,6};

   int array_size = 6;

   int result = minElement(arr,array_size);   //calling

   cout<<"The min value is: "<<result<<endl;

}

Explanation:

First include the library iostream in the c++ programming for input/output.

then, create the function minElement() for find the minimum value in the array.

it required the one loop for iterate the each element in the array and then compare with first element in the array which is store in the variable minimum.

if array element is less than the minimum then, update the value in the minimum variable.

after complete the loop, return the result.

for capture the result create the main function and call the function with parameter array.

and finally display the result.

You might be interested in
A ____________ is a set of commands which can be run by calling it by name.
mixas84 [53]
The answer to this question is a protocol.
7 0
4 years ago
Read 2 more answers
You are given a class named Clock that has one int instance variable called hours.
Vlad [161]

Answer:

public Clock(int hours) {

       this.hours = hours;

   }

Explanation:

In Java programming language, Constructors are special methods that are called to initialize the variables of a class when a new object of the class is created with the new keyword. Consider the complete code for the class below;

<em>public class Clock {</em>

<em>    private int hours;</em>

<em>    public Clock(int hours) {</em>

<em>        this.hours = hours;</em>

<em>    }</em>

<em>}</em>

In this example above,  an object of this class can created with this statement Clock myclock = new Clock(6); This is a call to the constructor and passes a parameter (6) for hours

7 0
3 years ago
What kind of operating system is Windows? Command-line Browser based Graphical user interface Linux-based
snow_tiger [21]
Graphical user interface
4 0
3 years ago
Read 2 more answers
Floating point values (real numbers that can handle up to 5 decimals)
Ann [662]

Answer:

1.45638

Explanation:

p please mark me as brainlest

4 0
3 years ago
A strategy for speeding up hard drive performance is _________.
Daniel [21]

Answer:disk caching

Explanation:

Disk caching speeds up hard drive performance

7 0
3 years ago
Read 2 more answers
Other questions:
  • Regarding the Internet of Things (IoT), a business involved in utilities, critical infrastructure, or environmental services can
    10·1 answer
  • You need to find out how much ram is installed in a system. what command do you execute to launch the system information utility
    12·1 answer
  • A user wants to make sure he can quickly restore his computer after a drive failure to the state it was in when Windows and all
    9·1 answer
  • Define networks, marketplaces, and platforms and discuss their differences.
    15·1 answer
  • Which type of cloud computing offers easily accessible software and applications on the machines?
    7·1 answer
  • A type of touch screen that can be up to four feet by six feet is a(n) _____.
    12·2 answers
  • The printer prints 16 pages every minute. How many pages are printed in 6 minutes?
    14·2 answers
  • Laptop computers use PCMCIA cards, another type of ________
    15·1 answer
  • EMERGENCY- I am giving 55 points for this, please help. WITH working out
    7·1 answer
  • Which symbol is used for an assignment statement in a flowchart?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!