home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 May
/
VPR9705A.ISO
/
VPR_DATA
/
PROGRAM
/
CBTRIAL
/
SETUP
/
DATA.Z
/
LEX_COMP.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-14
|
681b
|
28 lines
#include <algorithm>
#include <vector>
using namespace std;
int main(void)
{
int d1[5] = {1,3,5,32,64};
int d2[5] = {1,3,2,43,56};
//
// Set up vector.
//
vector<int> v1(d1+0, d1+5), v2(d2+0, d2+5);
//
// Is v1 less than v2 (I think not).
//
bool b1 = lexicographical_compare(v1.begin(),v1.end(),v2.begin(),v2.end());
//
// Is v2 less than v1 (yup, sure is).
//
bool b2 = lexicographical_compare(v2.begin(), v2.end(),
v1.begin(), v1.end(), less<int>());
cout << (b1 ? "TRUE" : "FALSE") << " "
<< (b2 ? "TRUE" : "FALSE") << endl;
return 0;
}