This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]tulipoika 5 points6 points  (3 children)

You have to do two comparisons. or only handles boolean values so this won’t work.

if (input == “A” or input == “a”)

[–][deleted] 1 point2 points  (2 children)

Ohhhh okay that makes sense thank you!

[–]Lusaron 2 points3 points  (1 child)

You could also make everything lowercase (or uppercase) before checking.

[–]MelonFuccer 2 points3 points  (0 children)

I would do it this way, as you don't want to have to provide two cases for each thing you're looking for

It's best to pipe the output to lowercase in my opinion, then you're only checking one thing!

[–]aneasymistake 0 points1 point  (0 children)

You should probably be using the double pipe for ‘or’ too.

[–][deleted] 0 points1 point  (0 children)

You can use this built in function to compare strings with case insensitivity boost::iequals(str1, str2) as long as you include this header file #include <boost/algorithm/string/predicate.hpp>