I am not sure what the goal exactly is so this proggy calculates the amount of characters in a string and counts the occurances of a certain character in a string.
Code:
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
string str = "hello johnny";
int i=str.size(); //i=12
int p = count(str.begin(), str.end(), 'h'); //p=2
return 0;
}