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
Will give brainlyist
In-s [12.5K]

i think its the first sentence: Mobile devices have become the main source of communication for many people around the world

if im wrong im dum ;-;

6 0
3 years ago
Read 2 more answers
A network technician cannot get a host to connect to the internet. running the ping command shows the apipa ip address. what is
Lunna [17]
The router will not connect to th network. This will keep it from connecting to the NEXUS
6 0
3 years ago
Why is wider channel bandwidth good?
Nookie1986 [14]

Answer:

The wider channel bandwidth is efficient and good as it help in increasing the speed of the transmission. Due to the wider channel of the bandwidth it also lead to consuming less energy of the battery and make cost effective.

Due to the wider bandwidth, the number of clients can easily share and transfer the data in the channel and also make the transmission complete.

If the channel of the bandwidth is double then, the single transmission can easily carry more data. Hence, it also lead to double the speed of the transmission.

7 0
3 years ago
Write a definition in your own words for Raster Graphic. Do not copy and paste please.
Vlada [557]

Answer:

Raster Graphic is a bitmap. They are basically a grid of small pixels that make an image.

6 0
3 years ago
When an instance of a class, or object, is specified as a parameter to a method, a reference to the said object is passed to the
OLEGan [10]
Or pointer

VERY similar.
5 0
3 years ago
Other questions:
  • Graphic designers sometimes must adjust the spacing between letters so that the result looks right to them. This is called
    12·1 answer
  • In your opinion, is it more beneficial to have many folders or is it better to “nest” subfolders? Explain your response.
    10·2 answers
  • Which of the following is an unintended consequence of pesticide use on crops?
    10·1 answer
  • Which option is most likely used to create many-to-many relationships in Access?
    8·1 answer
  • Create a loop that will output all the multiples of 5 that are greater than zero and less than 60 (do not include 60). 5, 10, 15
    10·1 answer
  • A student is curious about how a Web site appears on his computer screen. On a piece of paper,
    9·1 answer
  • Why is the ketboard calledQWERTY
    11·2 answers
  • What is up what everbody up to
    13·2 answers
  • Data type can only be true or false <br><br> Answer: Bool
    15·1 answer
  • to protect a windows 10 system, you've configured system restore to automatically protect your system using restore points. will
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!