I know how to lower a sentence, but I wanted to use my string modification class to do so. For some reason, using my Strmod object does not work, but doing it through main works. Here is the sentence lowering code:
TL;DR, answer: turns out I needed to pass the string to the object by reference! Below is the code that works:
transform(statement.begin(), statement.end(), statement.begin(), tolower);
And here is my class for it:
class Strmod {
public:
string lower(string &s) {
transform(s.begin(), s.end(), s.begin(), tolower);
return s;
}
};
And I call it like this:
int main(){
string statement = "";
getline(cin, statement);
Strmod mod;
mod.lower(statement);
cout << statement; //for debugging
}