Answers to Self-Review Exercises
-
#
.#elif
,#else
.#define
.whitespace.
#undef
.#ifdef
,#ifndef.
Conditional compilation.
assert
.#include
.##
.#
.\
.
E.2 (See below.)
1 // exE_02.cpp 2 // Self-Review Exercise E.2 solution. 3 #include <iostream> 4 using namespace std; 5 6 int main() { 7 cout << "__LINE__ = " << __LINE__ << endl 8 << "__FILE__ = " << __FILE__ << endl 9 << "__DATE__ = " << __DATE__ << endl 10 << "__TIME__ = " << __TIME__ << endl 11 << "__cplusplus = " << __cplusplus << endl; 12 } // end main
__LINE__ = 9 __FILE__ = c:\cpp4e\ch19\ex19_02.CPP __DATE__ = Jul 17 2002 __TIME__ = 09:55:58 __cplusplus = 199711L
-
#define YES 1
#define NO 0
#include "common.h"
#if defined(TRUE) #undef TRUE #define TRUE 1 #endif
Get C++ How to Program, 10/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.