如何用C ++编写这个条件? [英] How can I write this condition in C++ ?
本文介绍了如何用C ++编写这个条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
R [i] = max {A [i],B [i],C [i],D [i]}
我怎么写它是用C ++语言编写的?
我尝试过:
R [i] == max((A [i],B [i],C [i],D [i]))
R[i] = max{A[i],B[i],C[i],D[i]}
How can I write it in C++ language?
What I have tried:
R[i] == max((A[i],B[i],C[i],D[i]))
推荐答案
函数std: :max()(在< algorithm>中定义)只能返回最多两个数字。如果您需要最多N个数字,则必须对std :: max()进行N-1次调用。
The function std::max() (defined in <algorithm>) can only return the maximum of two numbers. If you need the maximum of N numbers, you will have to make N-1 calls to std::max().
这篇关于如何用C ++编写这个条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文