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
How do you strike through text in excel?
Valentin [98]
In the font options there is a checkbox for strikethrough. Same dialog as word, only there is no button in the ribbon for it. You could customize that by creating a custom group if you want to.
6 0
4 years ago
1.
slamgirl [31]
1. I believe it this, they way the question is phrased it seems like a personal opinion. But if we're being logical about this, no one likes background noise. So,yes, it's important. 
2. Yes, when you record something you don't want additional sound that has nothing to do with what you're recording. 
3.Yes, your main task is to be focused on what you're doing on the computer. You don't want to be distracted by unnecessary distractions. 
8 0
3 years ago
What is RAM? explain it
Zina [86]
RAM is memory in the computer
3 0
3 years ago
Read 2 more answers
Which area of the network would a college it staff most likely have to redesign as a direct result of many students bringing the
Artist 52 [7]
The area of network that the students would be using is the wireless LAN. For the wireless LAN, enables students to connect to the internet with the use of their tablets and smart phones for it is the network that connect to a network that are wireless and are not needed to be connected with the use of wires or cables.
6 0
3 years ago
Sara just started using the Internet she would like to be a little more efficient and 3 to 4 sentences give Saras some advice ab
kondor19780726 [428]

Answer:

Explanation:

Efficiency with using the internet is mainly about practice. First, you should focus on making sure that your mouse and keyboard are comfortable devices for you and are positioned in a way that best suits your sitting style. Next would be using a browser that allows extension installing as there are many extension applications that drastically simplify everyday internet tasks such as closing a tab, or copying and pasting some text. Lastly, would be practice. Nobody is efficient when they first start learning to use something new, it takes practice. The more you do something the better you get at it.

8 0
3 years ago
Other questions:
  • What is a tag in an HTML document?
    5·1 answer
  • Which program, available on all operating systems, provides all types of information from a dns server and allows you to query a
    8·1 answer
  • The actual database of Active Directory shared resources is stored on one or more computers designated as:
    10·1 answer
  • Se Statements
    6·1 answer
  • What is jcl language on the mainframe?
    10·1 answer
  • Who designed analatic engine in the 1930's?​
    10·1 answer
  • Network servers and web servers are examples of what type of server?
    9·2 answers
  • Which of the following is NOT a media file? *<br> .wav<br> .mp4<br> .exe
    10·1 answer
  • Who tryna trade in gta my psn is xMadOrNawx-_-
    11·2 answers
  • What file system supported by windows can be used for volumes and drives that don’t hold the windows installation? (choose all t
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!