Counting number of lowercase.[NEWBIE]
hi, i am new in this forum. i have a problem with my code. can someone correct it for me and give some advice.
i want to find out the number of lowercase letters used in the name...
this is the code tat i stuck with....
For instance:
Code:
int main()
{
string name;
cout<<"Enter name: ";
cin>>name;
for(int i=0; name[i]; i++)
{
if(islower(name[i]))
{
int sum = 0;
sum++;
cout<<sum;
}
}
and the output is 11 if i enter [Ben] as my input...
i want to count the it so the ouput will display 2.
can someone help me on this please.