Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- using std::string; using std::getline;
- #include <iostream>
- using std::cin; using std::cout; using std::endl;
- int main() {
- string s1;
- cout << "Enter the string: " << endl;
- getline(cin, s1);
- int count = 0;
- for (unsigned i = 0; i != s1.size(); ++i){
- if (s1[i] == 42 || s1[i] == 43 || s1[i] == 47 ){
- ++count;
- }
- }
- cout << "Number of symbols: " << count;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment