📄 chapter10-37.cpp
字号:
//文件名:CHAPTER10-37.cpp
#include <map>
#include <iostream>
#if _MSC_VER > 1020 // if VC++ version is > 4.2
using namespace std; // std c++ libs implemented in std
#endif
void main( )
{
map <int, int, less<int> > m1;
map <int, int, less<int> >::value_compare vc1 = m1.value_comp( );
pair< map<int,int>::iterator, bool > pr1, pr2;
pr1= m1.insert ( map <int, int> :: value_type ( 1, 10 ) );
pr2= m1.insert ( map <int, int> :: value_type ( 2, 5 ) );
if( vc1( *pr1.first, *pr2.first ) == true )
{ cout << "The element ( 1,10 ) precedes the element ( 2,5 )."<< endl; }
else
{ cout << "The element ( 1,10 ) does not precede the element ( 2,5 )."
<< endl;
}
if(vc1( *pr2.first, *pr1.first ) == true )
{ cout << "The element ( 2,5 ) precedes the element ( 1,10 )."<< endl; }
else
{ cout << "The element ( 2,5 ) does not precede the element ( 1,10 )."
<< endl; }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -