Hey I am a new C++ learner, I have been creating a program that do something specific... I take input from the user, and converted it into a lowercased sentence, then I use the "in"keyword like we use in python.... For example in python :
main_input = input("Type exit with a bunch of other words: ")
lower_input = main_input.lower()
if "exit" in lower_input:
exit()
else:
pass
What this does is that searches for the exit keyword from the input(like "ok you can exit now") and follows accordingly, exits the program. But how to use "in" keyword in c++? I want to do something like this:
#include <iostream>
#include "boost/algorithm/string.hpp"
using namespace std;
int main() {
while(true){
std::string main_input;
std::cout << "Type something: ";
std::cin >> main_input;
std::string lower_input = boost::algorithm::to_lower_copy(main_input);
/* the if statement below this, here is the problem...*/
if("exit" in lower_input){
std::cout << "Exiting";
/* after that other statements if necessary to execute*/
}
}
}
Can anyone tell me how to do that?? Thanks in advance!