Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string str="C++ Programming is awesome";
- char checkCharacter='a';
- int count=0;
- for (int i=0;i<str.size();i++)
- {
- if (str[i]==checkCharacter)
- {
- ++count;
- }
- }
- cout<<"Number of "<<checkCharacter<<" = "<<count;
- }
Advertisement
Add Comment
Please, Sign In to add comment