Advertisement
Pafnytiu

строки 3 - 9 оригинал

Dec 7th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9. string str;
  10. char m;
  11. getline(cin, str);
  12. cout << "Enter symbol: ";
  13. cin >> m;
  14. unsigned i, j;
  15. int count = -1;
  16.  
  17. for (i = 0; i < str.length(); i++)
  18.  
  19. {
  20. count++;
  21. if (str[i] == ';' || str[i] == '!' || str[i] == ' ' || str[i] == ',' || str[i] == '.')
  22. {
  23. if ((tolower(str[i - count])) == m && (tolower(str[i - 1] == m)))
  24. {
  25. for (j = i - count; j <= i - 1; j++)
  26. cout << str[j];
  27. cout << endl;
  28. }
  29. count = -1;
  30. }
  31. }
  32. system("pause");
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement