< previous page page_51 next page >

Page 51
The Payroll program in Chapter 1 uses the programmer-defined identifiers listed below. (Most of the other identifiers in the program are C++ reserved words.) Notice that we chose the names to convey how the identifiers are used.
IdentifierHow It Is Used
MAX_HOURSMaximum normal work hours
OVERTIMEOvertime pay rate factor
payRateAn employee's hourly pay rate
hoursThe number of hours an employee worked
wagesAn employee's weekly wages
totalThe sum of weekly wages for all employees (total company payroll)
empNumAn employee's identification number
payFileThe output file (where the employee's number, pay rate, hours, and wages are written)
CalcPayA function for computing an employee's wages

MATTERS OF STYLE
Using Meaningful, Readable Identifiers
The names we use to refer to things in our programs are totally meaningless to the computer. The computer behaves in the same way whether we call the value 3.14159265, pi, or cake, as long as we always call it the same thing. However, it is much easier for somebody to figure out how a program works if the names we choose for elements actually tell something about them. Whenever you have to make up a name for something in a program, try to pick one that will be meaningful to a person reading the program.
C++ is a case-sensitive language. Uppercase letters are different from lowercase letters. The identifiers
PRINTTOPPORTION printtopportion pRiNtToPpOrTiOn PrintTopPortion
are four distinct names and are not interchangeable in any way. As you can see, the last of these forms is the easiest to read. In this book, we use combinations of uppercase letters, lowercase letters, and underscores in identifiers. We explain our conventions for choosing between uppercase and lowercase as we proceed through this chapter.

 
< previous page page_51 next page >