惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
小众软件
小众软件
博客园 - 叶小钗
宝玉的分享
宝玉的分享
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
Google DeepMind News
Google DeepMind News
U
Unit 42
F
Fortinet All Blogs
IT之家
IT之家
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
T
The Blog of Author Tim Ferriss
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The GitHub Blog
The GitHub Blog
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell

博客园 - 凤凰_1

多边形近似:最小周长多边形算法MPP 多阈值otsu的opencv实现 在Opencv中自定义了一个相位函数,获取复数矩阵的相位 cvIsInf与cvIsNan函数 Mandelbrot set 以parallel_for_实现 opencv的并行操作parallel_for_的问题 CV_WRAP和CV_EXPORTS_W opencv超级像素示例 opencv中自定义的双线性二次插值的图像旋转及缩放 在Qt中,如何在sheets末端添加新的sheet opencv4.x 中的plot函数绘制二维Mat C++版DNN最简主体框架 C++版全连接神经网络 C++版加载MNIST图像集合 C++版的神经网络训练用的图像集合加载 自定义c++二维动态数组 用Cmake 编译OpenCV常见的错误 Opencv中的dft()和idft()示例 C++仿Matlab的bsxfun函数
c\c++宏定义,四个参数求最大值 - 凤凰_1 - 博客园
凤凰_1 · 2022-07-12 · via 博客园 - 凤凰_1
#include <iostream>
#define GetMax(a,b,c,d) a>b?(a>c?(a>d?a:d):(c>d?c:d)):\
                                                       \
                            (b>c?(b>d?b:d):(c>d?c:d))
using namespace std;

int main()
{
    float x=GetMax(3,2,1,5) ;
    cout <<x << endl;
    return 0;
}

为了方便参数运算,每个参数添加括号:

#include <iostream>
#define GetMax(a,b,c,d) (a)>(b)?((a)>(c)?((a)>(d)?(a):(d)):((c)>(d)?(c):(d))):\
                            ((b)>(c)?((b)>(d)?(b):(d)):((c)>(d)?(c):(d)))
using namespace std;

int main()
{
    float x=GetMax(8,2,1,5) ;
    cout <<x << endl;
    return 0;
}