<algorithm>
and need to know another way of doing this. My project is to write a program to accept from the user one line of text and count and output the number of lowercase letters. I have been reading and trying to figure out how to do this for the greater part of the day, finally broke down asked online and got an answer way over my head. The part I don't understand should be in bold. Thanks
|
|
[](unsigned char ch) { return islower(ch); }
is a lambda function. It's basically a function you can declare in place so you don't have to give it a name.size_t count = count_if(text.begin(), text.end(), islower);
if(getline(cin, text))
, how can I test for lowercase letters. I'm really honestly trying to learn this and not asking for you or anyone to do this for me. This is what I was given by my instructor to complete an 8 part assignment, this question is the first part.
|
|
|
|
|
|
|
|
|
|
string text;
, then each individual character can be referred to like this: text[n]
, use this instead of ch
in the code above.text.length()