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
2 Antworten
+ 4
#include <cctype>
for (char& c : input)
c = std::tolower(c); //higher also possible
+ 1
Thanks man! Timon Paßlick