【minmax()】

【minmax()】

包含在#include<algorithm>库内
以pair的形式返回传入的最小和最大值

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a = -10;
	int b = -20;
	auto result = minmax(a, b);
	cout << "smallest number is: " << result.first << endl;
	cout << "largest number is: " << result.second << endl;
	return 0;
}
posted @ 2025-04-01 14:27  White_ink  阅读(14)  评论(0)    收藏  举报