I want to do an if statement to compare two strings to see if they match. So:
if (TypedAnswerOne == CorrectAnswerOne) The code works if the correct answer is typed EXACTLY as it is in the CorrectAnswerOne string value. No problems at all.
However ... if the answer is typed slightly different as one word in stead of two words for example then it shows that the answer is wrong.
So I was wondering how do I can I do an "OR" with strings?
So:
if (TypedAnswerOne == CorrectAnswerOne or "dirtballs" or "Dirt Balls" or "dirt balls") How can I define "or" in CPP with strings?
TY :-)
.cppused as a file-extension but only because using plus symbols in filenames causes problems.std::vector) of your intended matches, then check that the string you want is in that list. If you're just matching against simple variants, maybe what you want is a regular expression that's more lenient, or you want to clean up the input, stripping spaces and lower-casing etc., to match more broadly.std::unordered_setwith a case-insensitive hashing function.std::unordered_set.