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
Luba_88 [7]
3 years ago
8

Write a function stats that takes an array and the number of elements in the array. Then, it computes and prints the minimum val

ue, maximum value, and the average value of all the values in the array. The output should be formatted with a two-digit precision. The function name: stats The function parameters (in this order): an array, double The number of elements in the array, int The function should not return anything.
Computers and Technology
1 answer:
BaLLatris [955]3 years ago
6 0

Answer:

#include<iostream>

using namespace std;

void stats(double [],int);  

int main()

{

int totalElements,i;

 

cout<<"Enter total elements:"<<endl;

cin>>totalElements;

double array[totalElements];

cout<<"Enter the elements in array:"<<endl;

for(i=0;i<totalElements;i++)

cin>>array[i];

stats(array,totalElements);  

}

void stats(double array[],int totalElements)

{

int i;

double minimum,maximum;

double Sum=0.0,average=0.0;

minimum=array[0],maximum=array[0];

for(i=0;i<totalElements;i++)

{

if(array[i]>maximum)

maximum=array[i];

if(array[i]<minimum)

minimum=array[i];

Sum+=array[i];

}

average=Sum/totalElements;

cout<<"Test: ";

for(i=0;i<totalElements;i++)

cout << fixed << setprecision(2) <<array[i]<<" ";

cout<<endl;

cout <<"minimum:"<< fixed << setprecision(2) <<minimum<<endl;

cout <<"maximum:"<< fixed << setprecision(2) <<maximum<<endl;

cout <<"average:"<< fixed << setprecision(2) <<average<<endl;

 

}

Explanation:

  • Loop through the total elements to get the input from user and call the stats function.
  • In the stats function check whether a number is maximum, minimum or average.
  • Calculate the average by finding the sum of all the numbers in array  and dividing it by total numbers.
  • Finally display the results.

You might be interested in
Disadvantages of Batch<br>operation system​
jok3333 [9.3K]

Answer:

Disadvantages of Batch Operating System:

  1. The computer operators should be well known with batch systems.
  2. Batch systems are hard to debug.
  3. It is sometime costly.
  4. The other jobs will have to wait for an unknown time if any job fails.
8 0
3 years ago
in a typical e-mail address, the "host" is A. an account designated by a user name B. CPU processor 2500 C. the receiver of an e
NISA [10]
The correct answer is A! :)
5 0
3 years ago
Read 2 more answers
is a security design principle to direct the selection of control layers for an organization's computing enclave to ensure its r
Rina8888 [55]

Answer:

Defense in Depth (DiD).

Explanation:

Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.

Defense in Depth (DiD) can be defined as a concept or framework in cyber security that typically involves the process of layering multiple defensive mechanisms and security control throughout an information technology (IT) system, so as to prevent data theft or an unauthorized access to user data.

Basically, this cyber security technique is designed such that when a layer of the defensive mechanism fails, another security layer step in to mitigate and prevent the attack. Thus, it causes redundancy when an attacker exploits a vulnerability in a system, a breach of security or when one of the security layers fail.

3 0
3 years ago
[Edhesive] 4.1 Code Practice
Mashcka [7]

Answer:

(In Python 3.8.6)

import sys

while 7 > 6:

   input = str(sys.stdin.readline())

    if input == "Nope":

           break

    else:

           print(f"Nice to meet you, {input}.")

4 0
3 years ago
Read 2 more answers
Which binary signaling technique uses a scheme in which zero voltage represents a 0 bit and the voltage for a 1 bit does not dro
prisoha [69]

Answer:

In binary signaling, Non Return to Zero (NRZ) is the technique in which zero voltage is represented by 0 bit while high voltage is represented by 1 until the voltage level change from high to low.

Explanation:

There are different techniques to encode the signal for transmission between transmitter and receiver. These techniques includes return to zero, non return to zero. In return to zero technique, the if the voltage is high the signal will become 1 for half of the time period and then after half time period it return to 0.

In NRZ the signal is 0 if the voltage level is zero. In case of high voltage of the signal the binary bit remains 1 until the next zero voltage level arrive in the signal until the end of the time period of bit.

6 0
4 years ago
Other questions:
  • When federal courts are evaluating digital evidence from computer-generated records, what exception is applied to hearsay?'
    13·1 answer
  • In a pie chart showing showing the voting choices of 120 voters, the blue slice of pie is half of the pie. This means of 60 vote
    12·2 answers
  • Monetary Policy can be either Expansionary or Contractionary. Which of the following actions classify as Expansionary Monetary P
    7·2 answers
  • Rite a c++ function, smallestindex, that takes as parameters an int array and its size and returns the index of the first occurr
    15·1 answer
  • Where should i go if i want to begin learning how to code a video game. What are your recommendations to a 16 yr old to learn co
    13·1 answer
  • Given the following code fragment and the input value of 4.0, what output is generated?
    8·1 answer
  • The design of a blog refers to:
    8·1 answer
  • Create a presentation on “Pets” and customize your presentation in the following ways:
    10·1 answer
  • How do I put in a micro sd card that is in a sd adapter in to my laptop to make it work PLEASE HELP
    10·1 answer
  • I need this answered
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!