Guest User

Untitled

a guest
Nov 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. char str(char *str[]) {
  2. int j = 0;
  3. for (int i = 0; i < sizeof(str) / sizeof(*str); i++) {
  4. if (str[i] == "a") {
  5. j++;
  6. }
  7. }
  8.  
  9.  
  10. return j;
  11. }
  12.  
  13.  
  14. Вызов функции в main.
  15. cout << str("saassssasasasass") << endl;
  16.  
  17. int str(const char *str)
  18. {
  19. int count = 0;
  20.  
  21. for(; *str; str++)
  22. if (*str == 'a') ++count;
  23.  
  24. return count;
  25. }
Add Comment
Please, Sign In to add comment