What is the usage of the min function in C++?
In C++, the min function is used to return the smaller of two numbers. Its usage is as follows:
#include <algorithm>
#include <iostream>
int main() {
int a = 5;
int b = 3;
int min_num = std::min(a, b);
std::cout << "The minimum number is: " << min_num << std::endl;
return 0;
}
In the example above, the min function will return the smaller number between a and b, which is 3.