C++ #if to check value

Description

C++ #if to check value

#if LANGUAGE == ENGLISH
  #define Greeting "Good Morning."
#elif LANGUAGE == GERMAN/*from ww  w.ja  v a  2  s  . co m*/
  #define Greeting "Guten Tag."
#elif LANGUAGE == FRENCH
  #define Greeting "Bonjour."
#else
  #define Greeting "Hi."
#endif
  std::cout << Greeting << std::endl;

Include different code depending on an identifier that represents a version number:

#if VERSION == 3
  // Code for version 3 here...
#elif VERSION == 2
  // Code for version 2 here...
#else
  // Code for original version 1 here...
#endif



PreviousNext

Related