题解 | 最大最小值

最大最小值

https://www.nowcoder.com/practice/051cbca4504d40f5b20bb891d83ec408

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << "The maximum number is : " << max({a, b, c}) << "\n";
    cout << "The minimum number is : " << min({a, b, c}) << "\n";
}

algorithm

最大值函数可以用 max(a, b),也可以多个参数 max({a, b, c, d});

最小值函数同理

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务