fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #define dim(a,b) ((a)*(b))
  4. #define row(a,b,c) a,b,c
  5. #define at(arr,a,b) arr[a*3+b]
  6. using namespace std;
  7.  
  8. int main() {
  9. int arr[dim(3,3)] = {
  10. row(1,2,31),
  11. row(3,5,6),
  12. row(7,1,0)
  13. };
  14. int max = *max_element(begin(arr), end(arr));
  15. cout << "Max: " << max << endl;
  16. cout << "At: " << at(arr, 0, 2) << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 4404KB
stdin
Standard input is empty
stdout
Max: 31
At: 31