A common task performed by computer programs is the production of financial statements for credit unions, banks, credit-card companies, and so on. These programs must accumulate transactions (deposits, withdrawals, purchases, payments) and frequently must count these transactions as well, in order to determine what fees, if any, must be paid by clients.
Today we looked at a simple example of an accumulator and a counter: the accumulation and counting of marks to enable the calculation of their arithmetic mean. This example, and those to follow, will lead nicely to a discussion of repetition—the final leg of our control-structures tripod.
Happiness is like manna; it is to be gathered in grains, and enjoyed every day. It will not keep; it cannot be accumulated; nor have we got to go out of ourselves or into remote places to gather it, since it has rained down from a Heaven, at our very door.—Tryon Edwards (1809–1894)
No comments:
Post a Comment