Lexicographical Order - C strings

May 8, 2015 at 9:58pm
Hello! I am studying for a final and I was given a pool of "questions" for studying. I am stumped when it comes to c strings because we barely covered them and I can't find anything in my book regarding lexicographical order.

Here is what I was given : "Given two c strings s1 and s2, write a if -else if - else statement to print out a message to indicate which string goes first in lexicographical order."

Can someone please help point me in the right direction on how to even begin writing the code for this?
May 9, 2015 at 12:24am
> I can't find anything in my book regarding lexicographical order.
alphabetic order


http://en.cppreference.com/w/cpp/string/basic_string/operator_cmp
The ordering comparisons are done lexicographically -- the comparison is performed by a function equivalent to std::lexicographical_compare.
May 9, 2015 at 12:32am
I understand the terminology, I just can't find anything in my book for it; I can find comparing strings, string lengths, etc.

The link you've provided is wonderful. Thank you very much.
Topic archived. No new replies allowed.