hello, what i'm wanting to do is take a month input(january february, etc) turn it to a 3 char string(jan, feb, mar) which i have, and then turn them to all lowercase, so as i don't haev to have 8 if statements(Jan, JAn, JaN, JAN, jAN, jaN, jAn, jan) to set up(therefore makeing 84 extra ifstatements, 12 months)
I've tried all sorts of variations, to no avail.(this is my first class in c++, 3rd in comp programing, so very new)
so please make the explanation fairly dumby proof if you can, if not any help is greatly appreciated. thank you.
the variable name is package
string month;
...(extra variables and shit)
getline(cin, month);
...(extra input from user)
month = month.substr(0, 3);
or, another solution to this would be to use something like java's string.equalsIg noreCase()
ie: if(month.equals IgnoreCase("jan "))
{
...
}
I've tried all sorts of variations, to no avail.(this is my first class in c++, 3rd in comp programing, so very new)
so please make the explanation fairly dumby proof if you can, if not any help is greatly appreciated. thank you.
the variable name is package
string month;
...(extra variables and shit)
getline(cin, month);
...(extra input from user)
month = month.substr(0, 3);
or, another solution to this would be to use something like java's string.equalsIg noreCase()
ie: if(month.equals IgnoreCase("jan "))
{
...
}
Comment