Anyone can explain me please? why this is true??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Anyone can explain me please? why this is true???

"cook" > "book" returns true

17th Jun 2018, 1:06 AM
LIM Chantha
LIM Chantha - avatar
3 Answers
+ 2
Because when comparing strings it does so alphabetically.
17th Jun 2018, 1:11 AM
Duncan
Duncan - avatar
+ 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
17th Jun 2018, 1:55 AM
MO ELomari
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😇
17th Jun 2018, 1:37 AM
Rawd Alhabbal
Rawd Alhabbal - avatar