template <class X> pairminmax( const X& kxrItem1, const X& kxrItem2 );
#include <algorithm>
template <class X, class BinaryPred> pairminmax( const X& kxrItem1, const X& kxrItem2, BinaryPred xComp );
#include <iostream> #include <algorithm> int main() { using namespace std; const double kdPi = 3.141259; const double kdE = 2.71828; // Find the smaller and larger of two values pair<double, double> qMinMax = minmax(kdPi, kdE); cout << "The smaller of " << kdPi << " and " << kdE << " is "; cout << qMinMax.first << endl; cout << "The larger of " << kdPi << " and " << kdE << " is "; cout << qMinMax.second << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.