Menu

[solved] – Question 86593

I am currently working on a program set and I was wondering if you could answer my question.
I have come across std::string letterOccurence(); and
I have done my code to let the program run; this is the code below: string str;
//cin>>str;
getline(cin,str);
char checkCharacter = ‘a’;
int count = 0;

for (int i = 0; i < str.size(); i++)
{
if (str[i] == checkCharacter)
{
++ count;
}
++checkCharacter +1;
}

cout << “Number of ” << checkCharacter << ” = ” << count;

return 0;
Apparently I should use a 2 dimensional array but I am stuck. Please help!

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *