Right now I have
Code:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string message;
int j, i;
cout << "Enter a String!\n";
getline(cin, message);
char SearchLetter;
cout << "Enter a letter to be searched\n ";
cin >> SearchLetter;
j = message.find(SearchLetter, 0);
for(i = 0; i <= j; i ++);
cout << "The number of times that letter appears in the string is " << i << endl;
system ("pause");
return 0;
}
Currently my program finds the index of where the letter appears in the string.
It's supposed to find out how many times the letter appears in the string.
In reality I would count from 1 til however many times I see the letter.