Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to get last element of set in c++

set<int> s = {1,2,3}
auto it = s.end();
it--;
cout<<*it<<"
"; // This refers to last element of a set
Comment

access last element of set c++

auto it = s.end();
it--;
cout<<*it<<"
"; 
Comment

PREVIOUS NEXT
Code Example
Cpp :: fork c 
Cpp :: c++ area of triangle 
Cpp :: c++ program to calculate discount 
Cpp :: C++ mutex lock/unlock 
Cpp :: c++ file exists 
Cpp :: 2d vector c++ declaration 
Cpp :: switch in c++ 
Cpp :: c++ how to check whether a file exists? 
Cpp :: cpp mst 
Cpp :: online cpp to exe converter 
Cpp :: reverse c++ string 
Cpp :: c++ declaring and initializing strings 
Cpp :: convert int to binary string c++ 
Cpp :: c++ length of char* 
Cpp :: strip space from string cpp 
Cpp :: http.begin() error 
Cpp :: set precision with fixed c++ 
Cpp :: string reverse stl 
Cpp :: c++ length of char array 
Cpp :: flags for g++ compiler 
Cpp :: delete a node from binery search tree c++ 
Cpp :: c++ cout colored output xcode 
Cpp :: cpp std list example 
Cpp :: change int to string c++ 
Cpp :: c++ default parameters 
Cpp :: how to find 2d vector length cpp 
Cpp :: how to initialize array with new in c++ 
Cpp :: back() in c++ 
Cpp :: cannot jump from switch statement to this case label c++ 
Cpp :: c++ average 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =