number of characters in a string c++ code example
Example 1: count a character in a string c++
count(str.begin(), str.end(), 'e')
Example 2: count number of char in a string c++
string str_V;
char chr
getline(cin, str_V);
for(i=0; i<=str.length; i++)
{
if(str[i]==chr)
{
space++
}
}