Vla_DOS

Untitled

Jun 20th, 2022
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int CountStr(string s) {
  6.     int count = 0;
  7.     for (int i = 0; i < s.size(); i++)
  8.         if (s[i] == '+') count++;
  9.     return count;
  10. }
  11. int main() {
  12.     setlocale(LC_CTYPE, "");
  13.     string str = "qwerty+2345+g";
  14.     cout << CountStr(str);
  15.  
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment