📜  c++ max of array - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:55.419000             🧑  作者: Mango

代码示例3
int main(int argc, char** argv) {
  int A[4] = {0, 2, 3, 1};
  const int N = sizeof(A) / sizeof(int);

  cout << "Index of max element: "
       << distance(A, max_element(A, A + N))
       << endl;

  return 0;
}