fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. int main()
  5. {
  6. int frequency[8] = {1,2,3,10,5,6,7,-8};
  7. int* p = max_element(frequency, frequency+8);
  8. cout << "The largest number is " << *p
  9. << " and it is in frequency[" << (p - frequency) << "]\n";
  10. }
  11.  
Success #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
The largest number is 10 and it is in frequency[3]