Table Of Contents
Previous Section Next Section

Program 77: No Value

The following program fails to compile because the value is undefined. We never use the variable value, so what's the problem?

  1 /************************************************
  2  * double -- Print a double table for the       *
  3  *      numbers 1 through 10.                   *
  4  ************************************************/
  5 #include <iostream>
  6
  7 /************************************************
  8  * DOUBLE -- Macro to double the value of a     *
  9  * number.                                      *
 10  ************************************************/
 11 #define DOUBLE (value) ((value) + (value))
 12
 13 int main()
 14 {
 15     // Counter for the double list
 16     int counter;
 17
 18     for (counter = 1; counter <= 10; ++counter)
 19     {
 20         std::cout << "Twice " << counter << " is " <<
 21             DOUBLE(counter) << '\n';
 22     }
 23
 24     return (0);
 25 }

(Next Hint 118. Answer 113.)

Table Of Contents
Previous Section Next Section