In Python, doing if a in b
is really easy, and I'm wondering if there's an equivalent in C++.
Specifically, I want to make a list of strings and check if an input is in that list.
std::string myinput;
std::string mylist[] = {"a", "b", "c"};
std::cin >> myinput;
// if myinput is included in mylist
// do other stuff here
How do I check using an if
whether the input myinput
is included in string mylist
?