C Tutorial/Preprocessor/if
Версия от 17:21, 25 мая 2010; (обсуждение)
#if
To define more generalized conditions.
Multiple conditions are connected by relational operators such as AND(&&), OR(||).
<source lang="cpp">#define USA 1
// #define EUP 1
- include <stdio.h>
- if ((1>0) && defined USA)
#define currency_rate 46
- endif
- if (defined (EUP))
#define currency_rate 100
- endif
main() {
int rs; rs = 10 * currency_rate; printf ("%d\n", rs);
}</source>
460