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
Give one (1) advantage and one(1) disadvantage of using and integrated software package over a custom written one.
Harrizon [31]

Answer:

See explanation

Explanation:

An Integrated software package is a kind of software package that combines various applications in just one program. It basically provides one spreadsheet, one word processing and database management. A good example is the Microsoft Office.

A custom written software package on the other hand is the type that is specially created for a particular business. It is created to meet the client's specifications and preferences.

An advantage of using integrated software is the low cost and fast deployment. Integrated software packages are relatively affordable and easy to acquire unlike that custom based ones that take time to create.

A disadvantage of the integrated software is the lack of control and flexibility. Because it is an integrated software package, you have no control over how it is built and on the long run their updates may not be what you want. And unlike the Custom written one, you cannot tell the developers to add or remove features that suit your needs.

7 0
3 years ago
How many people watch Anime in the world?
iren [92.7K]
3 to 4 billion people.

7 0
3 years ago
Read 2 more answers
FOLLOW INSTRUCTIONS BELOW , WRITTEN IN JAVA LANGUAGE PLEASE AND THANK YOU !
boyakko [2]
It’s a lot of reading sorry can’t help you but try your best too
7 0
3 years ago
The flagging of an uncommon last name as a spelling error can be stopped by opening the shortcut menu on the first occurrence of
Mice21 [21]

Solution:

The flagging of an uncommon last name as a spelling error can be stopped by opening the shortcut menu on the first occurrence of the name and selecting of ignoring all.

Thus the required right answer is B.

8 0
3 years ago
What is application launchers functions​
andrey2020 [161]
An app launcher replaces the stock user interface for organizing the home screen and app icons predominantly in the Android world; however, they are also available for jailbroken iPhones (see iPhone jailbreaking and Cydia). See Launchpad.
5 0
3 years ago
Other questions:
  • Which method of the form passes data without appending the parameters to the url?
    5·1 answer
  • What is the term used to describe data sets are so large and complex that they become difficult to process using traditional dat
    12·1 answer
  • A cooler with heat pipes, which contain a small amount of liquid that becomes a vapor when heated, allowing heat to be drawn awa
    10·1 answer
  • In which of the following scenarios would you choose to embed versus import data?
    8·1 answer
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • Juhfvehrfwhedfhwkefhkujhiuyuiyuiyiyh
    6·1 answer
  • Girls question <br> who wants to go out ;p
    11·2 answers
  • What would the internet be like today if there was no World Wide Web?
    9·1 answer
  • Where to get industrial circuits far cry 6
    8·1 answer
  • What is the purpose of the GETPIVOTDATA function?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!