当前位置:网站首页>C语言:#if、#def和#ifndef综合应用
C语言:#if、#def和#ifndef综合应用
2022-07-06 13:07:00 【念迟鱼学编程】
#include <stdio.h>
#define MAX
#define MAXIMUM(x,y) (x>y)?x:y
#define MINIMUM(x,y) (x>y)?y:x
int main()
{
int a = 10 , b = 20;
#ifdef MAX
printf("更大的数字是:%d\n",MAXIMUM(a,b));
#else
printf("更小的数字是:%d\n",MINIMUM(a,b));
#endif
#ifdef MIN
printf("更小的数字是:%d\n",MINIMUM(a,b));
#else
printf("更大的数字是:%d\n",MAXIMUM(a,b));
#endif
#undef MAX
#ifdef MAX
printf("更大的数字是:%d\n",MAXIMUM(a,b));
#else
printf("更小的数字是:%d\n",MINIMUM(a,b));
#endif
#define MIN
#ifndef MIN
printf("更小的数字是:%d\n",MINIMUM(a,b));
#else
printf("更大的数字是:%d\n",MAXIMUM(a,b));
#endif
return 0;
}
运行结果:
更大的数字是:20
更大的数字是:20
更小的数字是:10
更大的数字是:20
边栏推荐
- [MySQL] basic use of cursor
- [redis design and implementation] part I: summary of redis data structure and objects
- OneNote in-depth evaluation: using resources, plug-ins, templates
- After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers
- 代理和反向代理
- document.write()的用法-写入文本——修改样式、位置控制
- FZU 1686 龙之谜 重复覆盖
- 'class file has wrong version 52.0, should be 50.0' - class file has wrong version 52.0, should be 50.0
- Interviewer: what is the internal implementation of ordered collection in redis?
- R3live notes: image processing section
猜你喜欢
Why do job hopping take more than promotion?
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
Seven original sins of embedded development
[interpretation of the paper] machine learning technology for Cataract Classification / classification
What is the problem with the SQL group by statement
Deployment of external server area and dual machine hot standby of firewall Foundation
Interviewer: what is the internal implementation of ordered collection in redis?
039. (2.8) thoughts in the ward
ICML 2022 | Flowformer: 任务通用的线性复杂度Transformer
KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
随机推荐
快过年了,心也懒了
JS操作dom元素(一)——获取DOM节点的六种方式
HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅
Le langage r visualise les relations entre plus de deux variables de classification (catégories), crée des plots Mosaiques en utilisant la fonction Mosaic dans le paquet VCD, et visualise les relation
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
【mysql】游标的基本使用
js之遍历数组、字符串
3D人脸重建:从基础知识到识别/重建方法!
Pat 1078 hashing (25 points) ⼆ times ⽅ exploration method
OneNote 深度评测:使用资源、插件、模版
@GetMapping、@PostMapping 和 @RequestMapping详细区别附实战代码(全)
2017 8th Blue Bridge Cup group a provincial tournament
Replace Internet TV set-top box application through digital TV and broadband network
Common English vocabulary that every programmer must master (recommended Collection)
Ravendb starts -- document metadata
OSPF multi zone configuration
【力扣刷题】32. 最长有效括号
Absolute primes (C language)
防火墙基础之外网服务器区部署和双机热备
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother