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
When you are almost done with your soup and want to get at the last little bit, how should you do this 2
pav-90 [236]

Answer:

<u>B. Tip the bowl slightly, then spoon up the last bit</u>

Explanation:

Generally speaking none of the other answers made much of sense.. "tip the bowl from side to side" doesn't help you at all, neither does "Keep spooning as much as you can, then stop eating". Neither of these will help you spoon up the last little bit, <u>the most logical answer is B. "Tip the bowl slightly, then spoon up the last bit"</u>. If this is not the correct answer then it'd be D, but I don't believe/feel that it's "poor etiquette" to "leave the last little bit".

7 0
3 years ago
Which one of the following statements is true for spell checkers? A. A word you know to be correctly spelled may be flagged as m
dybincka [34]
"Most spell checkers flag inappropriate word usage" is the one statement among the following choices given in the question that is true <span>for spell checkers. The correct option among all the options that are given in the question is the second option or option "B". I hope the answer helped you.</span>
8 0
3 years ago
Social media has evolved rapidly in this digital era, from email and text messages to instant updates, image sharing, and media
Sidana [21]
Bro no one is going to help you write a two page report do it yourself are you that lazy?
6 0
3 years ago
One of the ways to create a horizontal navigation menu from an unordered list is to a. set the display property of the element w
Gennadij [26K]

Answer: a. set the display property of the element within each li element to inline

Explanation: In an unordered list, <em>ul</em> signifies the list and <em>li</em> signifies the elements in the list. When you want to display the elements in a list in a horizontal form, for example if you need a horizontal menu, a quick way of doing this is setting the display of li to inline by writing it as follows in css:

<em>li { </em>

<em>Display: inline; </em>

<em>} </em>

This will order the elements in the list into the form of a horizontal menu .

8 0
3 years ago
Which of the following best describes the safety of blogging
Pavlova-9 [17]
We need the options
3 0
3 years ago
Other questions:
  • What does using indirect quotations allow a writer to do?
    7·2 answers
  • Technological _____ is the term used to describe the merging of several technologies into a single device.
    13·1 answer
  • The Top status bar command is used to display the highest value in the selected range in the AutoCalculate area. (True/False)
    7·1 answer
  • What type of major application has most changed the way people interact in their daily lives?
    5·1 answer
  • This week you will learn about basic code structure. The term structure, as it relates to programming, refers to the decisions y
    14·1 answer
  • Knowing and understanding the targeted audience is a main compnent to creating a website
    15·1 answer
  • One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a numbe
    15·1 answer
  • To output age for the user which of the following you need to use?
    7·1 answer
  • A technology called ______
    11·1 answer
  • A museum is evaluating historical documents for authenticity, reviewing their physical condition, and categorizing them by subje
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!