You can write a lot less code, and make it more readable, if you have a function that does that for you:
if (none_of( are_you_sure, "Si", "si", "No", "no"))
// ...
Of course, that function has to be written, but it's not too much code with c++17 fold-expressions:
template<typename T, typename ...Opts>
auto none_of(T val, Opts ...opts)
{
return (... && (val != opts));
}
This has some nice properties; it can take any number of arguments, and also be used with types other than strings:
int n = 42;
if (none_of( n, 1, 2, 3))
// ...
Make sure to name the function well, as that affects readability a lot.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…