W3School TIY Editor

  • W3School 在线教程
  • 改变方向
  • 暗黑模式
​x
 
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
​
int main() {
  // 创建存储整数的向量 numbers
  vector<int> numbers = {1, 7, 3, 5, 9, 2};
 
  // 查找最大数字
  auto it = max_element(numbers.begin(), numbers.end());
  
  cout << *it;
  
  return 0;
}