answer.
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
lilavasa [31]
1 year ago
12

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

that it has been passed so far. So, if you make these calls to averager, averager(5.0), averager(15.0), averager(4.3), the values returned will be (respectively): 5.0, 10.0, 8.1. Hint: use a static local variable to track the average of all the numbers been called.
Computers and Technology
1 answer:
lys-0071 [83]1 year ago
4 0

Answer:

Following are the definition of function  

double averager (const double &x)  // function definition

{

static double z = 0.0;  // variable declaration

static size_t c = 0;

 c=c+1;  // increment of c by 1

z =z+ x;  // adding value  

return z /c ;   // return average  

}

Explanation:

Following are the description of statement  

  • Create a function averager of double type that holds a parameter "x" of the double type .
  • In this function we declared a variable "z" of a static double type that value is initialized by 0.
  • The static variable is used to retain value.
  • Declared a variable "c" of size_t type that holds a value 0 .
  • After that increment the value of c by 1 .
  • adding the value of "z" variable to the "x" and storing the result into the z variable.
  • Finally return the average value  
You might be interested in
Which of the following is ideal for long distance communication ?
Vinvika [58]
Microwave transmission is ideal for long distance communication. It is so good that it is used for satellite and space probe communication.
3 0
2 years ago
Which are examples of copyrighted online materials? Check all that apply.
Stella [2.4K]
The answers are 1, 3, and 5.
7 0
1 year ago
Read 2 more answers
The second version of css, css2, was introduced in 1998, expanding the language to provide styles to _________.
Evgen [1.6K]

Answer:

Structured Documents

Explanation:

Structured Documents consist of hierarchy in the files. They may include data files. HTML (Hyper-text markup language) documents and XML (Extensible Markup Language) applications are the examples of Structured Documents.

6 0
2 years ago
If there are 8 opcodes and 10 registers, a. What is the minimum number of bits required to represent the OPCODE? b. What is the
Nimfa-mama [501]

Answer:  

For 32 bits Instruction Format:

OPCODE   DR               SR1                   SR2      Unused bits

a) Minimum number of bits required to represent the OPCODE = 3 bits

There are 8 opcodes. Patterns required for these opcodes must be unique. For this purpose, take log base 2 of 8 and then ceil the result.

Ceil (log2 (8)) = 3

b) Minimum number of bits For Destination Register(DR) = 4 bits

There are 10 registers. For unique register values take log base 2 of 10 and then ceil the value.  4 bits are required for each register. Hence, DR, SR1 and SR2 all require 12 bits in all.  

Ceil (log2 (10)) = 4

c) Maximum number of UNUSED bits in Instruction encoding = 17 bits

Total number of bits used = bits used for registers + bits used for OPCODE  

     = 12 + 3 = 15  

Total  number of bits for instruction format = 32  

Maximum  No. of Unused bits = 32 – 15 = 17 bits  

OPCODE                DR              SR1             SR2              Unused bits

  3 bits              4 bits          4 bits           4 bits                17 bits

7 0
2 years ago
Which of the following statements regarding critical paths is true? a. On a specific project, there can be multiple critical pat
iVinArrow [24]

Answer:

Option a

Explanation:

The Critical Path Method is the arrangement of booked exercises that decides the term of the task. These planned exercises must be performed if the venture is to be viewed as a triumph.

Therefore, options b, c, d and e can't be true because:

b. Activities in the Critical Path Method has no or zero slack.

c. The duration of the critical path in CPM determined on the basis of the latest activity and the earliest initiation.

d. The CPM method schedules the activity of the longest duration.

7 0
2 years ago
Other questions:
  • In which of the following situations may you pass on the right
    13·2 answers
  • Edward has started up a new company with his friend, Matthew. Currently, he has only two people working with him. Which type of
    8·1 answer
  • Does the Boolean expression count > 0 and total / count > 0 contain a potential error? If so, what is it?
    8·1 answer
  • A small company is moving towards sharing printers to reduce the number of printers used within the company. The technician has
    14·1 answer
  • The computer component that makes sure that instructions are decoded and executed properly is the ___________.
    11·2 answers
  • There are two methods of enforcing the rule that only one device can transmit. In the centralized method, one station is in cont
    5·1 answer
  • In Section 8.5.4, we described a situation in which we prevent deadlock by ensuring that all locks are acquired in a certain ord
    11·1 answer
  • In this problem, we want to compare the computational performance of symmetric and asymmetric algorithms. Assume a fast public-k
    11·1 answer
  • Quantum units of information deploy the properties of entanglement and ____ to offer exponentially greater computing power.
    9·1 answer
  • The code below assigns the 5th letter of each word in food to the new list fifth. However, the code currently produces errors. I
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!