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 of the following shows the correct order of inventions that helped the first computers make calculations?
castortr0y [4]

Answer:

1st - Mechanical Relays, 2nd - Vacuum tubes, 3rd - Transistors

Explanation:

<em>From Tubes...</em>

<em />

The three main components of a basic triode vacuum tube.

The type of tube used in early computers was called a triode and was invented by Lee De Forest in 1906. It consists of a cathode and a plate, separated by a control grid, suspended in a glass vacuum tube. The cathode is heated by a red-hot electric filament, which causes it to emit electrons that are attracted to the plate. The control grid in the middle can control this flow of electrons. By making it negative, you cause the electrons to be repelled back to the cathode; by making it positive, you cause them to be attracted toward the plate. Thus, by controlling the grid current, you can control the on/off output of the plate.

Unfortunately, the tube was inefficient as a switch. It consumed a great deal of electrical power and gave off enormous heat—a significant problem in the earlier systems. Primarily because of the heat they generated, tubes were notoriously unreliable—in larger systems, one failed every couple of hours or so.

<em>...To Transistors</em>

<em />

The invention of the transistor was one of the most important developments leading to the personal computer revolution.The transistor was invented in 1947 and announced in 1948 by Bell Laboratory engineers John Bardeen and Walter Brattain. Bell associate William Shockley invented the junction transistor a few months later, and all three jointly shared the Nobel Prize in Physics in 1956 for inventing the transistor. The transistor, which essentially functions as a solid-state electronic switch, replaced the less-suitable vacuum tube. Because the transistor was so much smaller and consumed significantly less power, a computer system built with transistors was also much smaller, faster, and more efficient than a computer system built with vacuum tubes.

The conversion from tubes to transistors began the trend toward miniaturization that continues to this day. Today’s small laptop PC (or netbook, if you prefer) and even Tablet PC systems, which run on batteries, have more computing power than many earlier systems that filled rooms and consumed huge amounts of electrical power.

8 0
3 years ago
Technician A says that PTC heaters can be built into a conventional heater core assembly. Technician B says that a PTC heater's
Art [367]

Answer:

A) Technician A only.

Explanation:

Only Technician A who said that Positive Temperature Coefficient (PTC ) heaters can be built into a conventional heater core assembly is correct because they use the same heat loss and transfer system. This is easily verifiable with a simulation.

Technician B, who said that a PTC heater's electrical resistance will decrease as its temperature increases is incorrect because the resistance of a conductor is directly proportional to temperature. This means that a PTC heater's electrical resistance will increase as its temperature increases.

7 0
3 years ago
2. How can Tailwind Traders ensure applications use geo-redundancy to create highly available storage applications?
Nataly [62]

Tailwind Traders CAN ensure applications use geo-redundancy to create highly available storage applications by:

  • Running one's application in read-only mode.
  • Enforcing its use.

<h3>What is geo redundant storage?</h3>

Geo-redundant storage (GRS) is known to be a device that tends to copy one's data synchronously three times in the same or inside a single physical location in the primary region via the use of LRS.

Note that in the case above,  Tailwind Traders CAN ensure applications use geo-redundancy to create highly available storage applications by:

  • Running one's application in read-only mode.
  • Enforcing its use.

Learn more about Geo-redundant storage from

https://brainly.in/question/6073238

#SPJ1

6 0
2 years ago
A company asked you help mitigate the brute force attacks carried out against its users' Windows account passwords. You successf
alexdok [17]

Answer:

a. Require user account passwords

e. Set failed logon restrictions

b. Require strong passwords

Explanation:

3 0
3 years ago
Why might a business choose a server-based network over a peer-to-peer network?
valina [46]

Answer:

Hope this helps you out    Answer: Greater security

Explanation:

Server maintains better relationship with server at everry time. So it gives maximum of security and reliability against unauthorised access

3 0
3 years ago
Other questions:
  • What of the following google tools support collaboration
    10·1 answer
  • The four functions of a computer are
    5·1 answer
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • Which best describes the relationship between maximum cost-per-click (max. cpc) bids and ad rank?
    12·1 answer
  • Function Name: d2x Parameters: int, int Returns: string Description: Write function, d2x, that takes as input a nonnegative inte
    10·1 answer
  • Retype and run, note incorrect behavior. Then fix errors in the code, which should print num_stars asterisks.
    9·1 answer
  • What are the functions of super computer?<br> ​
    7·2 answers
  • Figure out what this says:<br><br> ?driew tib a kool ti seoD
    7·1 answer
  • PLEASE I NEED HELP WITH THIS, IS FOR TODAY
    10·2 answers
  • What is the name of the directory that contains symbolic links to unix sysv rc scripts for runlevel 2?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!