Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7. setlocale(LC_ALL, "Russian");
  8. //// Введение
  9. cout << "Введите слово в строку S = ";
  10. char S[100];
  11. cin.getline(S, 100);
  12. cout << "Введите число N = ";
  13. int N;
  14. cin >> N;
  15. ////
  16. if (strlen(S) > N) {
  17. while (strlen(S) - 1 != N-1) {
  18. for (int i = 0; i < strlen(S); i++) {
  19. S[i] = S[i + 1];
  20. }
  21. }
  22. }
  23. int k = 0;
  24. if (strlen(S) < N) {
  25. while (strlen(S) + 1 != N) {
  26. for (int i = 0; i < strlen(S); i++) {
  27. k = strlen(S) - i;
  28. S[strlen(S) + i] = S[k];
  29. cout << S << endl;
  30. }
  31. S[k] = '.';
  32. }
  33. }
  34. cout << S << endl;
  35. system("pause");
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement