#include <algorithm> // std::min
std::min(1,2);
int n = min({2,3,4,5});
// n = 2
#include <iostream>
template <class T> const T& min(const T& a, const T& b)
{
return a < b ? a : b;
}
int main()
{
std::cout << min(1, 2) << std::endl;
}
Code Example |
---|
Cpp :: cpp create lambda with recursion |
Cpp :: how to reverse a string in c++ |
Cpp :: comparator in sort c++ |
Cpp :: how to search in array c++ |
Cpp :: 3d projection onto 2d plane algorithm |
Cpp :: cpp absolute value |
Cpp :: bee 1002 solution |
Cpp :: c++ get line |
Cpp :: pragma cpp |
Cpp :: string vector to string c++ |
Cpp :: unordered_set to vector |
Cpp :: c++ 14 for sublime windoes build system |
Cpp :: temperature conversion in c++ |
Cpp :: c++ reverse string |
Cpp :: insertion sort cpp |
Cpp :: c++ if example |
Cpp :: c function as paramter |
Cpp :: c++ clip values |
Cpp :: c++ #define |
Cpp :: create matrix cpp |
Cpp :: c++ random number |
Cpp :: read string with spaces in c++ |
Cpp :: c++ math |
Cpp :: online ide c++ |
Cpp :: how creat matrix column in c++ |
Cpp :: pointers and arrays in c++ |
Cpp :: makefile for single cpp file |
Cpp :: how to format big numbers with commas in c++ |
Cpp :: opengl draw house using glut c++ |
Cpp :: c++ insert hashmap |