Answers for "lexiographic value of string c++"

C++
0

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"; 
    } 
}
Posted by: Guest on October-30-2020

Browse Popular Code Answers by Language