当前位置:网站首页>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
边栏推荐
- @GetMapping、@PostMapping 和 @RequestMapping详细区别附实战代码(全)
- [Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)
- 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人脸重建:从基础知识到识别/重建方法!
- 【深度学习】PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
- 039. (2.8) thoughts in the ward
- The use method of string is startwith () - start with XX, endswith () - end with XX, trim () - delete spaces at both ends
- js中,字符串和数组互转(二)——数组转为字符串的方法
- KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning
- The difference between break and continue in the for loop -- break completely end the loop & continue terminate this loop
猜你喜欢
嵌入式开发的7大原罪
Caching strategies overview
[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)
【论文解读】用于白内障分级/分类的机器学习技术
OneNote 深度评测:使用资源、插件、模版
2017 8th Blue Bridge Cup group a provincial tournament
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
2022 fields Award Announced! The first Korean Xu Long'er was on the list, and four post-80s women won the prize. Ukrainian female mathematicians became the only two women to win the prize in history
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
随机推荐
SDL2来源分析7:演出(SDL_RenderPresent())
启动嵌入式间:资源有限的系统启动
string的底层实现
Set up a time server
[interpretation of the paper] machine learning technology for Cataract Classification / classification
document. Usage of write () - write text - modify style and position control
数据湖(八):Iceberg数据存储格式
@Detailed differences among getmapping, @postmapping and @requestmapping, with actual combat code (all)
【力扣刷题】32. 最长有效括号
Dialogue with Jia Yangqing, vice president of Alibaba: pursuing a big model is not a bad thing
el-table表格——获取单击的是第几行和第几列 & 表格排序之el-table与sort-change、el-table-column与sort-method & 清除排序-clearSort
14年本科毕业,转行软件测试,薪资13.5K
It's almost the new year, and my heart is lazy
R3live notes: image processing section
After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers
R语言可视化两个以上的分类(类别)变量之间的关系、使用vcd包中的Mosaic函数创建马赛克图( Mosaic plots)、分别可视化两个、三个、四个分类变量的关系的马赛克图
Three schemes of SVM to realize multi classification
Web开发小妙招:巧用ThreadLocal规避层层传值
Why do job hopping take more than promotion?
VIM basic configuration and frequently used commands