Tag: tutorial
All the articles with the tag "tutorial".
-
INT_MAX and INT_MIN in C++: The Maximum and Minimum int Value
The maximum value of an int in C++ is 2147483647 and the minimum is -2147483648. How to get them with INT_MAX, INT_MIN and numeric_limits, plus overflow traps.
-
How to Read Multiple Inputs on One Line in C++
Read several values from one line in C++ with cin, getline and stringstream. Handle unknown counts, comma-separated input, and reading until the user stops.
-
How to Sort a Map by Value in C++
A std::map always sorts by key, never by value. Here is the standard way to sort map entries by value in C++ using a vector of pairs, plus ties and top-N.
-
How to Use a Vector of Pairs in C++
Create, fill, sort and iterate a std::vector of std::pair in C++. Sort by first or second element, use structured bindings, and know when to use a map instead.