lexcmp2.cpp

We use cookies. Read the Privacy and Cookie Policy

lexcmp2.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, greater‹char›());

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

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

 return 0;

}