C++的max

使用 max 比较多个数字(在c++20生效):

 1 #include <iostream>
 2 
 3 using namespace std;
 4 
 5 int main()
 6 {
 7     int a = 0,b = 9,c = 9,d = 7;
 8     cout << max( {a,b,c,d} ) << endl;   //   参数使用初始化列表方式传入
 9     return 0;
10 }

 

posted @ 2020-10-02 21:39  黎曼猜想  阅读(1129)  评论(0)    收藏  举报