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
Iteru [2.4K]
4 years ago
9

Write a complete function called lowestPosition() which takes as array (of double) and the number of elements used in the array

(as an int) and returns the position of the element with the least value (as an int). You may assume the number of elements is >
Computers and Technology
1 answer:
stiv31 [10]4 years ago
3 0

Answer:

#include <bits/stdc++.h>

using namespace std;

int lowestPosition(double elements[],int n)//function to find position of lowest value element.

{

   int i,pos;

   double min=INT_MAX;

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

   {

       if(elements[i]<min)

       {

           min=elements[i];

           pos=i;//storing index.

       }

   }

   return pos+1;//returning pos +1 to give the correct position in the array.

}

int main() {

double ele[500];

int n;

cout<<"Enter number of values"<<endl;

cin>>n;

cout<<"Enter elements"<<endl;

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

{

   cin>>ele[i];

}

int pos=lowestPosition(ele,n);//function call.

cout<<"The position of element with minimum value is "<<pos<<endl;

return 0;

}

Output:-

Enter number of values

5

Enter elements

4 6 7 5 1

The position of element with minimum value is 5

Explanation:

I have created a function lowestPosition() with arguments double array and it's size.I have taken a integer variable pos to store the index and after finding minimum and index i am returning pos+1 just to return correct position in the array.

You might be interested in
At the data link layer, which type of network address is used to identify the receiving node?
Anna [14]

The MAC address, type of network address is used to identify the receiving node.

<h3>What is A MAC address?</h3>

This is known to be a kind of physical address that is often given to each network adapter in a computer, or any kind of mobile device.

This is made up of twelve hexadecimal characters and as such, The MAC address, type of network address is used to identify the receiving node.

Learn more about MAC address  from

brainly.com/question/13267309

#SPJ11

3 0
2 years ago
Read 2 more answers
An OR function nested in an IF function results in
tester [92]
I think is the second one
5 0
3 years ago
Apples and bananas apples and bananas
melamori03 [73]

Answer:

bananas and apples bananas and apples?

Explanation:

8 0
3 years ago
Read 2 more answers
6. What is the correct way to write 340,000,000 in scientific notation? (1 point
givi [52]

Answer:3.4X10^8

Explanation:

4 0
3 years ago
Sang ayon kaba sa pahayag na walang sinuman ang nabubuhay para sa sarili lamang? bakit?
d1i1m1o1n [39]
What language is this?
7 0
3 years ago
Other questions:
  • Industrial Products is a small light-manufacturing firm that produces a variety of control systems for heavy industry. It has a
    13·1 answer
  • Which of the following is not a job title associated with a career in visual and audio technology? master control operator produ
    9·1 answer
  • What is a lan adapter
    7·2 answers
  • World Book is a/an A. Social media platform. B. Textbook. C. Almanac. D. Encyclopedia.
    7·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    5·1 answer
  • Tascake Gets Free Brainliest Because he didnt get it<br><br> Tascake Heres Brainliest
    6·2 answers
  • Louis has entered a column of expense values. What feature can he use to insert the total expenses at the end of the column?
    6·1 answer
  • What science category includes physics and biology?
    14·1 answer
  • With working from home now becoming a norm what is an effective network for an organization to secure its internal resources acc
    14·1 answer
  • In order to control access to a company's intranet and other internal networks, all communications pass through a _____ server.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!