Bob103

римская 3 строки

Dec 22nd, 2015
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5.  
  6.  
  7.  
  8. void main()
  9. {
  10. string str;
  11. cout << "Enter the string: ";
  12. getline(cin, str);
  13. for (int i = 0; i < str.size(); i++) {
  14. if (isupper(str[i]) && ((i == 0) || (str[i - 1] == ' ')))
  15. {
  16. int k = i;
  17. while ((str[i] != ' ') && (str[i] != '\0')) i++;
  18. str.erase(k, (i - k));
  19. i = k;
  20.  
  21.  
  22. }
  23. }
  24. cout << str << endl;
  25.  
  26. system("pause");
  27. }
Add Comment
Please, Sign In to add comment