counting letters in string

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; int main() { cout << "Hello World!" << endl ; string str ; std :: string :: iterator it ; getline(cin , str); int i = str.length() ; int count = 0 ; cout <<"enterd string is : " << str << endl << "length of string is : " << i << endl ; for(it = str.begin() ; it != str.end() ; ++it) { if( *it == 'p') { count = count + 1; } } cout << " number of times " << " letter occurs is " << count << endl ; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines