获取向量中的最大值和最小值
获取向量中的最大值和最小值
int main()
{
int a[] = { 2, 3, 5, 4, 5 };
vector<int>b(a,a+5); // a way to construst vecour
auto p = max_element(b.begin(), b.end());
vector<int>::iterator q = min_element(b.begin(), b.end());
cout << *p << endl;
cout << *q << endl;
return 0;
}