C++ examples for STL Algorithm:min
Performing Comparisons Using min and max
#include <iostream> #include <algorithm> using namespace std; int main()/*from w ww. j a v a2 s. c o m*/ { int Number1, Number2; cout << "Type the first number: "; cin >> Number1; cout << "Type the second number: "; cin >> Number2; cout << "The minimum number is: " << min(Number1, Number2) << endl; cout << "The maximum number is: " << max(Number1, Number2) << endl; return 0; }