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
olya-2409 [2.1K]
3 years ago
5

Write a program that reads 20 integers from the user into an array and uses a function arrayMinimum that accepts an integer arra

y along with its size as parameters and returns the smallest element of the array. The program needs to output the result (the smallest array element).
Computers and Technology
1 answer:
neonofarm [45]3 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int arrayMinimum(int myArray[], int myArraySize) {

int small = myArray[0];

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

   if(myArray[i]<small){

small = myArray[i];

}

 }

 return small;

}

int main(){

   int myArray[20];

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

       cin>>myArray[i];          

   }

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

Explanation:

This solution is provided in c++

#include <iostream>

using namespace std;

This line defines the arrayMinimum function

int arrayMinimum(int myArray[], int myArraySize) {

This initializes the smallest of the array element to the first

int small = myArray[0];

This iterates through the array

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

This if condition checks for the smallest

   if(myArray[i]<small){

The smallest is assigned to the small variable

small = myArray[i];

}

 }

This returns the smallest

 return small;

}

The main method begins here

int main(){

This declares an array of 20 elements

   int myArray[20];

The following iteration allows user input into the array

<em>    for(int i =0;i<20;i++){ </em>

<em>        cin>>myArray[i];          </em>

<em>    } </em>

This calls the method and returns the minimum

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

You might be interested in
55555,5555,555,55,5​
REY [17]

Answer: Decreasing Function????????????????????????????????

Explanation:

I'm confused, but I'm still gonna try and answer

6 0
3 years ago
Which type of topology describes the physical arrangement, installation, and connection of cables, computer, and other devices?
Nutka1998 [239]
<span>The network topology describes the physical arrangement, installation, and connection of cables, computer, and other devices.
The network topology can be bus topology (a</span><span> network topology that uses a single cable or conductor to connect all nodes on the network.) ,</span>star topology (a network topology in which cables running from each node connect to a single point, such as a hub.), ring (a network topology that consists of a single cable that runs continuously from node to node), mesh, hybrid, hub topology,... according the arrangement of the nodes. 

8 0
3 years ago
Read 2 more answers
The program used to create the file where you want to insert the object is called the ____.
BlackZzzverrR [31]
It is called the OLE
3 0
4 years ago
The Smith family wants to relocate to a neighborhood with better schools before their three-year-old goes to kindergarten. They
alexdok [17]

byron is a lanlord or real estate agent

taylor is a babysitter or a maid

travis is a banking agent.

8 0
3 years ago
Read 2 more answers
When entering a function or formula in a cell, which is the first character
AnnZ [28]

Answer:

B

Explanation:

6 0
3 years ago
Other questions:
  • A school librarian has been asked to identify inappropriate Internet usage. Which students would most likely be reported to the
    5·2 answers
  • Explain the steps you take to complete an Internet search. Do you use a particular search engine every time or do you alternate?
    12·1 answer
  • The ____ feature automatically locates specific text and then replaces it with desired text. Find and Replace Locator Locate and
    6·1 answer
  • What is metrical task system algorithm?? and can we use that in online shopping project??
    11·1 answer
  • IMPORTANT!!<br><br> How can you get real answer keys for edmentum (plato) courses as a student?
    11·1 answer
  • Why is page formatting important??​
    10·2 answers
  • Identify the selector in the following CSS code:
    10·1 answer
  • Consider the following class, which models a bank account. The deposit method is intended to update the account balance by a giv
    8·1 answer
  • Why do you want to work from our company?​
    9·2 answers
  • Your connection to this site is not secure how to fix.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!