I have a piece of code that asks for user input, it is type "string" and its a really simple process, i want whatever the user inputs to be converted using the tolower() function. It does exactly as its supposed to do, but i can't seem to assign it to the same variable. Any help please?
#include <locale> #include <string> #include <iostream> //maybe some other headers, but headers aren't the problem, so I am not going to list them all while (nCommand == 0) { locale loc; string sCommand; cin >> sCommand; for (int i = 0; i < sCommand.length(); ++i) { sCommand = tolower(sCommand[i],loc); cout << sCommand; } For example if the user types in Help sCommand would be h
How I want it to look like it that if the user types in HELP or Help or HeLp
sCommand should be 'help' either way
[C++11: 21.4.1.1.2/10]/[C99: 7.4.2.1/3])