📜  向量c++代码示例中最大元素的位置

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

代码示例4
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;
}