User input.

Say I have a program does something when the user inputs "yes". Now I want my program to do this same thing if user input is something like "Yes" or any other combination of capital and lower-case letters y , e and s.
Is there any easy way to do this other than checking for every combination?
A couple of ways to do that:

1
2
3
4
  std::string my_string = "mY sTrInG";
  for(unsigned int i = 0; i < my_string.length(); ++i) 
  { my_string[i] = tolower(my_string[i]);
  } 


Or:

1
2
  std::string word = "All Over The Case";
  std::transform (word.begin(), word.end(), word.begin(), tolower);





Awesome thanks AbstractionAnon
Topic archived. No new replies allowed.