C++ code to count letters in a string
In C++, by using the isupper(int) and islower(int) functions to indicate whether a character is an upper case letter or a lower case letter, you can count the upper case and lower case letters in a string.
using namespace std;
string st="C++ programming";
int countup=0, countlo=0,i;
else if(islower(st[i])) countlo++;
cout<<"Number of upper case letters:"<<countup<<"\n";
cout<<"Number of lower case letters:"<<countlo<<"\n";
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
Copyright @ 2011-2013 worldbestlearningcenter. All Rights Reserved.