Advertisement
Guest User

Untitled

a guest
Mar 21st, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <Windows.h>
  4. using namespace std;
  5.  
  6. const int BUFSIZE = 256;
  7. char buf[BUFSIZE];
  8.  
  9. int main()
  10. {
  11. setlocale(LC_ALL, "Russian");
  12. int n, i, N, b=0;
  13. char w = 'б';
  14. char W = 'Б';
  15. cout << "Введите длину строки ";
  16. cin >> N; { char *s = new char[N];
  17. cout << "Введи строку текста \n ";
  18. cin.get();
  19. cin.getline(s, N);
  20. n = strlen(s);
  21. for (i = 0; i < n; i++)
  22. if (s[i] == ' ')
  23. {
  24. if ( int(s[i+1]) == int(W)) b++;
  25. if ( int(s[i+1]) == int(w)) b++;
  26. }
  27. cout << "Кол-во слов на букву Б - " << b << "\n"; }
  28. return (0);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement