How it works...
Four macros, called Qty, FestivalOffer, DiscountCoupon, and Kindle, are defined with the values of 10, 2, 5, and 2, respectively. The user is prompted to enter the price of a book. The value entered by the user is assigned to the variable price. The #if, #elif, #else, and #endif conditional directives are then used to determine the amount of discount to be applied to the books depending on the value of the Qty macro. Because, the current value of the Qty macro is 10, the value of the discount variable will be set to 15 through the preprocessor directives. The value of the discount variable can be changed at any time simply by changing the value of the Qty macro. The total number of the books is computed by multiplying the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access