C++ Programming Tutorial: Comparing strings and characters

preview_player
Показать описание
Let's see how C++ compares characters and strings! How does it tell that 'A' comes before 'B'? Does '!' come before '*'? What does that even mean? We'll find out.
Рекомендации по теме
Комментарии
Автор

i've been searching for this and found the best explanation, great job, thanks for your effort

somayahalharty
Автор

Thank you sir, this is what I was looking for. Great explanation.

zhenquan
Автор

u just saved me on my midterm... peace and love unto u

MIQUELLASBLADE
Автор

my test is so strange.

bool a = "C"<"B";
bool b = 'C'<'B';

A warning during compiling first: comparison against a string literal is unspecified.
and then the result confused me.
a returned 1, b returned 0.
please give me some advice, sir.

howard_yin
Автор

if we are comparing abc to d, which one is bigger ?

hxh
Автор

In the first example you have Mary> Mark how could Mary comes after Mark???? This is completely wrong isn't!?

souha
Автор

"aw" < "aws" = true
"aws" < "aw" = true ( I thought this was false )
What is happening on this one sir? Thank you

mearskdiaz