题解 | 最大最小值
最大最小值
https://www.nowcoder.com/practice/051cbca4504d40f5b20bb891d83ec408
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
// 确定最大值
int max_num = a;
if (b > max_num) max_num = b;
if (c > max_num) max_num = c;
// 确定最小值
int min_num = a;
if (b < min_num) min_num = b;
if (c < min_num) min_num = c;
// 统一输出
cout << "The maximum number is : " << max_num << endl;
cout << "The minimum number is : " << min_num << endl;
return 0;
}
快手成长空间 763人发布