lexcmp1.cpp

We use cookies. Read the Privacy and Cookie Policy

lexcmp1.cpp

#include ‹stl.h›

#include ‹iostream.h›

const unsigned size = 6;

char n1[size] = "shoe";

char n2[size] = "shine";

int main() {

 bool before = lexicographical_compare(n1, n1 + size, n2, n2 + size);

 if (before) cout ‹‹ n1 ‹‹ " is before " ‹‹ n2 ‹‹ endl;

 else cout ‹‹ n2 ‹‹ " is before " ‹‹ n1 ‹‹ endl;

 return 0;

}