Do <and> in C ++ strings reflect the alphabetical order?

I have a question about the alphabetical order of strings in C ++. Let's say I have two lines:

    string x="asd123";
    string y="asd136";


Can we compare these lines with <or> operators? For example: can we say

    if(x>y)
    cout<<".....";

Does it always work? Thank.
+5
source share
2 answers

( ) , , . ; . ASCII, , , - .

+9

, std::string std::string::operator> . . , , , , .

< std::basic_string. a std::string char <. char s. ++, char - . ( ++ ASCII).

+6

All Articles