Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main () {
- string ed;
- char letter;
- int izon, count = 0;
- system("cls");
- cout << "Problem 4 - Counting Letter" << endl;
- cout << "--------------------------------\n";
- cout << "Enter Text: ";
- getline (cin, ed);
- cout << "Letter to count: ";
- cin >> letter;
- izon = ed.length();
- while (izon>0){
- izon--;
- if (ed[izon]==letter){
- count++;
- }
- }
- cout << count << " Letter " << letter << "!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment