0
Anyone can explain me please? why this is true???
"cook" > "book" returns true
3 Respuestas
+ 2
Because when comparing strings it does so alphabetically.
+ 2
strings are compared according to their position in the ascii collating sequence
ascii table:
http://www.asciitable.com/mobile/
here is an example:
https://code.sololearn.com/cHi3r5wmj2JI/#cpp
0
forget about letter ook
they are the same
every letter has a number according to its alphabetical order
a=1
b=2
c=3
d=4....
.
.
.
and those numbers used to compare strings
"c" >"b"
"ook" ="ook"
"cook" > "book"
hope that helps😇