设为首页 加入收藏

TOP

#if,#ifdef和#ifndef的综合应用
2014-11-24 00:33:11 来源: 作者: 【 】 浏览:22
Tags:#if #ifdef #ifndef 综合 应用
1 #include
2
3 #define MAX
4
5 #define MAXIMUM(x,y) x>y x:y
6 #define MINIMUM(x,y) x 7
8 int main()
9 {
10 int a=10,b=20;
11
12 #ifdef MAX
13 printf("\40:The larger one is %d\n",MAXIMUM(a,b));
14 #else
15 printf("\40:The lower one is %d\n",MINIMUM(a,b));
16 #endif
17
18
19 #ifndef MIN
20 printf("\40:The lower is %d\n",MINIMUM(a,b));
21 #else
22 printf("\40:The larger one is %d\n",MAXIMUM(a,b));
23 #endif
24
25 #undef MAX
26 #ifdef MAX
27 printf("\40:The larger one is %d\n",MAXIMUM(a,b));
28 #else
29 printf("\40:The lower one is %d\n",MINIMUM(a,b));
30 #endif
31
32
33 #define MIN
34 #ifndef MIN
35 printf("\40:The lower one is %d\n",MINIMUM(a,b));
36 #else
37 printf("\40:The larger one is %d\n",MAXIMUM(a,b));
38 #endif
39 return 0;
40
41 }



摘自 zhengmian
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇define > < == 下一篇堆栈,堆栈,堆和栈的区别

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: