LoGoFiOS

vk003

Mar 17th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <string>
  2. using std::string; using std::getline;
  3.  
  4. #include <iostream>
  5. using std::cin; using std::cout; using std::endl;
  6.  
  7. int main() {
  8.     string s1;
  9.     cout << "Enter the string: " << endl;
  10.     getline(cin, s1);
  11.     int count = 0;
  12.     for (unsigned i = 0; i != s1.size(); ++i){
  13.         if (s1[i] == 42 || s1[i] == 43 || s1[i] == 47 ){
  14.             ++count;
  15.         }
  16.     }
  17.     cout << "Number of symbols: " << count;
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment