0

Question regarding user input and Strings

Say I was to code a bot which replies to user input... eg: someone would say hello and it would reply with a defined response, I was wondering if it is possible to make the user input non case sensitive, I can't be expected to enter every possible way that someone can say 'hello' in order for the program to select a defined response? Keeping in mind I am using c++. Thanks guys. https://code.sololearn.com/cG6DU9dTyjjg/?ref=app

3rd May 2018, 5:03 AM
Jordan Patterson
Jordan Patterson - avatar
2 ответов
+ 4
#include <cctype> for (char& c : input) c = std::tolower(c); //higher also possible
3rd May 2018, 5:08 AM
Timon Paßlick
+ 1
Thanks man! Timon Paßlick
3rd May 2018, 5:12 AM
Jordan Patterson
Jordan Patterson - avatar