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

Write a program that asks the user to input an integer named numDoubles. Create a dynamic array that can store numDoubles double

s and make a loop that allows the user to enter a double into each array entry. Loop through the array, calculate the average, and output it. Delete the memory allocated to your dynamic array before exiting.
Computers and Technology
1 answer:
Hitman42 [59]3 years ago
6 0

Answer:

Answered in C++

#include <iostream>

using namespace std;

int main() {

   int size;

   cout<<"Length of array: ";

   cin >> size;

   double *numDoubles = new double[size];

   double sum =0;

   cout<<"Array Elements: ";

   for(int i=0;i<size;i++){

       cin>>numDoubles[i];

       sum += numDoubles[i];

   }

   delete [] numDoubles;

   cout<<"Average: "<<sum/size;

   return 0;  

}

Explanation:

This line declares the size (or length) of the array

<em>    int size; </em>

This line prompts the user for the array length

<em>    cout<<"Length of array: "; </em>

This gets the input from the user

<em>    cin >> size; </em>

This dynamically declares the array as of double datatype

<em>    double *numDoubles = new double[size]; </em>

This declares and initializes sum to 0

<em>    double sum =0; </em>

This prompts the user for elements of the array

<em>    cout<<"Array Elements: "; </em>

The following iteration gets input from the user and also calculates the sum of the array elements

<em>    for(int i=0;i<size;i++){ </em>

<em>        cin>>numDoubles[i]; </em>

<em>        sum += numDoubles[i]; </em>

<em>    } </em>

This deletes the array

<em>    delete [] myarray; </em>

This calculates and prints the average of the array

<em>    cout<<"Average: "<<sum/size; </em>

You might be interested in
Technician A says that high pressure in recycled refrigerant is only caused by air contamination. Technician B says that recycle
hjlf

Answer:

a. A only

Explanation:

When air, is in excess of allowable amounts, it  can cause the system to operate at pressures that are higher than normal. This means that the recycled refrigerant is operating at high pressure. Thus Technician A is correct.

However, Technician B is incorrect because unlike reclaimed refrigerants where the process strip the refrigerant of impurities making it to meet the standards of a new refrigerant, the recycled refrigerant is not as pure as it's contaminants are only reduced.

Therefore, only technician A is correct.

6 0
3 years ago
What tool allows you to search external competitive intelligence research?
enot [183]

Answer:

SocialPeta

Explanation:

4 0
1 year ago
A technician wants to replace a failing power supply on a high-end gaming computer. which form factor should the technician be l
Semmy [17]

A technician need to use the form factor or the  technician be looking for what we call EPS12V.

<h3>What is an EPS power connector?</h3>

The EPS connector is known to be used to supply power to the  motherboard CPU socket and the PCI is known to be one that functions to express connector.

Note that this is said to be a server standard (EPS12V) and it is also known to be one that can be said to be a desktop standard (ATX12V).

Note that the EPS12V is one that is known to always be seen in an 8-pin CPU connector and therefore, A technician need to use the form factor or the  technician be looking for what we call EPS12V.

Learn more about technician from

brainly.com/question/2328085

#SPJ1

5 0
1 year ago
Which of the following is an external hard drive
fredd [130]

Answer:

Question 1 = D

Explanation:

7 0
2 years ago
Audra is creating a training document and would like to include an image that she sees on her screen that she has marked up for
kupik [55]

Answer:

the first and last one

Explanation:

give me brainilest

4 0
3 years ago
Read 2 more answers
Other questions:
  • Algorithm for converting decimal into binary.
    7·1 answer
  • You are an inventor. You are taking out an ad in a newspaper because you want people to buy/use your product/invention. Include
    9·1 answer
  • You find that you are missing a very important file. After much searching, you have determined that it is no longer on your comp
    13·2 answers
  • If a*b = 2a - 56, calculate the value of<br>3 * 4​
    14·1 answer
  • Edhesive 3.2 Lesson Practice question 1
    5·1 answer
  • The parts of a memo are _____.
    9·2 answers
  • Which of the following is a programming language that permits Web site designers to run applications on the user's computer?
    15·1 answer
  • Helllllllllppppppppppp
    9·1 answer
  • Tasks you can perform online include which of the following?
    13·1 answer
  • How does robotic process automation (rpa) differ from intelligent automation
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!