Руководство по стандартной библиотеке шаблонов STL

         

const unsigned size


#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; }



#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; }


Содержание раздела