If we have a paper width of 8.5 inches and use 1 inch for margins (1/2 inch each side), how much usable space do we have left? Anyone can see that the result is 7.5 inches. But this program sees things differently. What's happening?
1 /************************************************
2 * paper_size -- Find the usable width on *
3 * a page. *
4 ************************************************/
5 #define PAPER_WIDTH 8.5; // Width of the page
6 #define MARGIN 1.0; // Total margins
7 // Usable space on the page
8 #define USABLE PAPER_WIDTH -MARGIN;
9
10 #include <iostream>
11
12 int main()
13 {
14 // The usable width
15 double text_width = USABLE;
16
17 std::cout << "Text width is " <<
18 text_width << '\n';
19 return (0);
20 }