-
-
Save amankharwal/955edd783a7c5e85541ad2ba93b2423e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main(){ | |
int count = 0; | |
char input; | |
string word; | |
cout<<"Enter a Word: "; | |
cin>>word; | |
cout<<"Enter a Character That You Want to Count: "; | |
cin>>input; | |
for(int i = 0; i < word.size(); i++){ | |
if (word.at(i) == input){ | |
count++; | |
} | |
} | |
cout<<count<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment