fork download
  1. #include <iostream>
  2. #include <array>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main() {
  7. array<int,5> Array;
  8. for(auto& i:Array) {
  9. cin>>i;
  10. }
  11.  
  12. const auto min_max = minmax_element(begin(Array), end(Array));
  13.  
  14. cout << "Min=" << *min_max.first << endl
  15. << "Max=" << *min_max.second << endl;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 3464KB
stdin
1
3
4
5
6
stdout
Min=1
Max=6