Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

find largest number in vector c++

#include <algorithm> // max_element
#include <vector> 
#include <iostream> // cout 
using namespace std;
int main(){
  vector<int> v1{ 10, 20, 30, 40, 50, 25, 15 };
  cout << *max_element(v1.begin(), v1.end());
}
 
PREVIOUS NEXT
Tagged: #find #largest #number #vector
ADD COMMENT
Topic
Name
9+6 =