## Do one thing, and do it well

In our first installment, we wrote several programs that really did nothing more than illustrate a concept. Let’s turn the complexity up a notch and compose a program that actually solves a problem. The problem we are tasked with: given the high temperature of the past three days, compute the average and standard deviation.

To do this, we are going to need to implement an algorithm, the programming equivalent to a set of directions. It gives the major steps that one must take in order to solve a problem, but the details of how are left up to the programmer who implements the algorithm. For our problem at hand, we could write out our algorithm as follows:

- Read in three values
- Compute the sum of these values
- Compute the average by dividing the sum by 3.
- Figure out how far each value is from the average.
- Add the distances obtained in step four
- Take the square root of the value in step five
- Divide by the square root of 3

So, let us set out to implement our remedial algorithm in MHF:

Read 67 remaining paragraphs | Comments

via Ars Technica » Technology Lab http://feeds.arstechnica.com/~r/arstechnica/technology-lab/~3/oTZHS2llqiM/