A friend asked me for help in C ++. I do not use only C ++ C # (WP, WPF, WinForms) and Java (Android).
Part of the task he has is when the STAR macro is defined, he should draw a christmass tree with * (stars), when the EQ macro is defined, he suggested that he should draw it with = (assign an operator). If both are undefined, compilation failed. Drawing a christmass tree is a simple task in any language, but I have problems with preprocessor macros.
#define STAR *
#define EQ =
#if !(defined(STAR) ^ defined(EQ))
FAIL TO COMPILE?
#endif
How then to check in the code which macro is defined and assign its value char character;?
source
share