当前位置:网站首页>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
边栏推荐
- 在最长的距离二叉树结点
- OSPF多区域配置
- JS according to the Chinese Alphabet (province) or according to the English alphabet - Za sort &az sort
- 监控界的最强王者,没有之一!
- 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
- 'class file has wrong version 52.0, should be 50.0' - class file has wrong version 52.0, should be 50.0
- c#使用oracle存储过程获取结果集实例
- js通过数组内容来获取数组下标
- js中,字符串和数组互转(一)——字符串转为数组的方法
- 防火墙基础之外网服务器区部署和双机热备
猜你喜欢

Set up a time server

面试官:Redis中有序集合的内部实现方式是什么?
![[redis design and implementation] part I: summary of redis data structure and objects](/img/2e/b147aa1e23757519a5d049c88113fe.png)
[redis design and implementation] part I: summary of redis data structure and objects

The difference between break and continue in the for loop -- break completely end the loop & continue terminate this loop

Summary of cross partition scheme

Internet News: Geely officially acquired Meizu; Intensive insulin purchase was fully implemented in 31 provinces

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

OneNote 深度评测:使用资源、插件、模版
![[MySQL] basic use of cursor](/img/cc/39b1e17b48d0de641d3cbffbf2335a.png)
[MySQL] basic use of cursor

Reference frame generation based on deep learning
随机推荐
Thinking about agile development
Notes - detailed steps of training, testing and verification of yolo-v4-tiny source code
039. (2.8) thoughts in the ward
R language for text mining Part4 text classification
R language visualizes the relationship between more than two classification (category) variables, uses mosaic function in VCD package to create mosaic plots, and visualizes the relationship between tw
document. Usage of write () - write text - modify style and position control
Divide candy
[redis design and implementation] part I: summary of redis data structure and objects
967- letter combination of telephone number
字符串的使用方法之startwith()-以XX开头、endsWith()-以XX结尾、trim()-删除两端空格
[Li Kou brush questions] 32 Longest valid bracket
3D人脸重建:从基础知识到识别/重建方法!
[MySQL] basic use of cursor
MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
968 edit distance
Swagger UI教程 API 文档神器
Absolute primes (C language)
跨分片方案 总结
互联网快讯:吉利正式收购魅族;胰岛素集采在31省全面落地
The most comprehensive new database in the whole network, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, flying Book Multidimensional table, heipayun, Zhix