STL的min_element和max_element

min_element()和max_element

头文件:#include<algorithm>

作用:返回容器中最小值和最大值。max_element(first,end,cmp);

它们的返回值都是地址,需要加*

例:

printf("%d\n",*max_element(a,a+n));

猜你喜欢

转载自blog.csdn.net/lijunyan5/article/details/82779252