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]
2 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]2 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
Which term describes the process of training a machine to do simple, repetitive tasks, and adapt or correct its performance base
yKpoI14uk [10]
Automation. ... It involves taking a machine or software that was taught to do simple repetitive tasks (traditional automation) and teaching it to intuitively adapt or correct its performance based on changing conditions, at speed and scale.
8 0
2 years ago
Which of the following is a Layer 3 protocol designed to permit routers to exchange information about networks that are reachabl
Nikolay [14]

Answer:

a. Routing protocol

Explanation

Routing protocol is a layer 3 (Network layer) protocol used by routers to exchange information about available routes , their associated costs and delays.

5 0
3 years ago
Read 2 more answers
After the data are appropriately processed, transformed, and stored, what is a good starting point for data mining?
Oksana_A [137]

Data visualization

Data visualization is a good starting point for data mining. There are several approaches to data mining that supports smart decisions. Data visualization places data in a visual context. It extracts the data in a clear and understandable way without any form of reading or writing. Results are displayed in the form of pie charts, graphs, and any other statistical representation. Such multidimensional views of data aid in developing a preliminary understanding of the trends that are hidden in the data set.

7 0
3 years ago
___________ is produced by propulsion systems or engines.
Rama09 [41]
I think it’s thrust good luck
8 0
3 years ago
What does "CYBER-COCKROACH" mean??
katrin2010 [14]

Answer:

The cyber cockroach is the presented external anatomy of a cockroach, with labeled views of photographs from diverse angles in place of diagrams. The cyber cockroach can be navigated around the head, thorax and abdomen with possible close up views of the legs and the images are downloadable

Cyber cockroach is a useful tool for the study of insects of the Blattodea order

Explanation:

3 0
3 years ago
Other questions:
  • What is the best Graphics Card you can get in a Gaming Computer? Also what is the RAM do in a Comptuer
    6·1 answer
  • What mass of nh3 can be made from 35g of n2?
    14·1 answer
  • What are some objects in your home that demonstrate electrical energy to radiant energy to thermal energy
    10·2 answers
  • "the master boot record (mbr) method of partitioning hard drives is limited to what maximum size of drives
    13·1 answer
  • Examine the following code.
    9·1 answer
  • When targeting customers of the consumer population at market a product, what type of segmentation information would be most hel
    12·2 answers
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • There is a file of a few Sean Connery movies on the internet. Each entry has the following form:
    9·1 answer
  • Accenture has put together a coalition of several ecosystem partners to implement the principles of blockchain and Multi-party S
    10·1 answer
  • Phân tích cạnh tranh của cocacola và pepsi
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!