< previous page page_63 next page >

Page 63
(text box continued from previous page)
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
This convention, widely used by C++ programmers, is an immediate signal that UPPER_LIMIT is a named constant and not a variable, a function, or a data type.
These conventions are only thatconventions. C++ does not require this particular style of capitalizing identifiers. You may wish to capitalize in a different fashion. But whatever you use, it is essential that you use a consistent style throughout your program. A person reading your program will be confused or misled if you use a random style of capitalization.

Taking Action: Executable Statements
Up to this point we've looked at ways of declaring data objects in a program. Now we turn our attention to ways of acting, or performing operations, on data.
Assignment
The value of a variable is changed through an assignment statement. For example,
quizScore = 10;
assigns the value 10 to the variable quizScore (stores the value 10 into the memory location called quizScore).
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif 3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Assignment Statement A statement that stores the value of an expression into a variable.
Here's the syntax template for an assignment statement:
AssignmentStatement
Variable = Expression ;

The semantics (meaning) of the assignment operator (=) is store; the value of the expression is stored into the variable. Any previous value in the variable is destroyed and replaced by the value of the expression.
Only one variable can be on the left-hand side of an assignment statement. An assignment statement is not like a math equation (x + y = z + 4);

 
< previous page page_63 next page >