Use min for char and integer : min « STL Algorithms Min Max « C++






Use min for char and integer

  
 
#include <iostream>
using std::cout;
using std::endl;

#include <algorithm>

int main()
{
   cout << "\nThe minimum of 'G' and 'Z' is: " << std::min( 'G', 'Z' );
   cout << "\nThe minimum of 12 and 7 is: " << std::min( 12, 7 );
   cout << endl; 
   return 0;
}

/* 

The minimum of 'G' and 'Z' is: G
The minimum of 12 and 7 is: 7

 */        
    
  








Related examples in the same category

1.Call min() with special comparison function
2.Get min and max value from a vector with your won logic
3.Finding the Minimum and Maximum of a Data Type