lexicographic value of string c++ code example
Example: lexiographic value of string c++
#include<iostream>
#include<algorithm> // for lexicographical_compare()
using namespace std;
int main()
{
char one[] = "mynameisomkar";
char two[] = "xyz";
if( lexicographical_compare(one, one+13, two, two+3))
{
cout << "mynameisomkar is lexicographically less than xyz";
}
else
{
cout << "mynameisomkar is not lexicographically less than xyz";
}
}