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
Neporo4naja [7]
3 years ago
11

Write the definition of a function named averager that receives a double parameter and returns-- as a double -- the average valu

e that it has been passed so far. So, if you make these calls to average, averager(5.0), averager(15.0), averager(4,3), the values returned will be (respectively): 5.0, 10.0, 8.1.
Computers and Technology
1 answer:
vladimir1956 [14]3 years ago
7 0

Answer:

double averager (double &newNumber)

{

static double sum = 0.0;

static int counter = 0;

counter++;

sum += newNumber;

return sum / counter;

}

Explanation:

This exercise is for you to understand how to use variables in functions that have scope outside of the function. The static keyword before a initialising a variable whether int or double or float or string, place the variable on the STATIC MEMORY. This means that when the function ends, those static variables are still usable and can be manipulated with the same stored values.  So when the function sees the

static double sum = 0.0;

for the second time it IGNORES it and continues with the previously stored value.

You might be interested in
What bug was supposed to start affecting computers on january 1 2000
horsena [70]

Answer: Y2K bug, also called Year 2000 bug or Millennium Bug

5 0
3 years ago
Computer applications
posledela

Answer:

please tell the question clearly

8 0
3 years ago
How to assign some object key values to other name react const.
notsponge [240]

Props are an ordinary object of React that follow the immutable properties. This simply means that you cannot change their value throughout the component. Props and states are in the form of an object which contains the number of key value pairs that could be used to render the value of the objects

8 0
2 years ago
What are the basic problem that my pc can have?
Lena [83]
A virus, malware, unplugged, used too much storage, etc.
5 0
4 years ago
An object reference is required for the nonstatic field method or property True or False
Marizza181 [45]
I believe its false.
6 0
3 years ago
Other questions:
  • How many bones are in a human body
    7·2 answers
  • Which is the output of the formula =XOR(120<102;83=83;51<24)??
    11·2 answers
  • Which business document is usually written in block style with the body tedt aligned along its left margin?
    9·1 answer
  • The idea that managers tend to communicate more with other managers who share similar beliefs and experiences is represented by
    8·1 answer
  • What is the most important trait of the first pilot project in the AI Transformation Playbook?
    10·1 answer
  • PLZ HELP
    15·2 answers
  • How do i make a comment on brainly?
    15·1 answer
  • What are the common internal components to most electronic devices?
    10·1 answer
  • What the three factors that AI is using for information gathering
    7·1 answer
  • What function would you use to calculate the total interest paid for the first year of a mortgage?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!