The C++ program shown in Listing 6 illustrates constants.

(Note the use of const to declare a constant.)

The program shows that an attempt to modify the value of a const variable after it is initialized results in a compiler error.

The program displays the following output on the screen when the offending statement is disabled by turning it into a comment: