I was just playing around with c++ and decided to make a text based RPG. I created a method to get info from the user and change it to lower case. This is the function:
std::string getInfo_ToLower(std::string whatToSay) {
std::string a = "";
std::cout << whatToSay << std::endl;
getline(std::cin, a);
for(int i = 0; i < a.length(); i++){
a[i] = putchar(tolower(a[i]));
}
return a;
};
Im working on Xcode if that helps. So, is there any reason that this method would only work every other time I called it and is there a reason my "return a;" is printing to the console?
Thanks.