fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. #define MAX_NUM 7
  5. int main() {
  6. int myints[MAX_NUM] = {3,7,2,5,6,4,9};
  7.  
  8. // using default comparison:
  9. std::cout << "The largest element is " << *std::max_element(myints,myints+MAX_NUM) << '\n';
  10. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
The largest element is 9