Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. void shiftLeft(char myarray[], int size, int shiftBy)
  5. {
  6. if (shiftBy > size){
  7. shiftBy = shiftBy - size;
  8. }
  9.  
  10. if (size == 1){
  11.  
  12. }
  13. else{
  14. char temp;
  15.  
  16. for (int i = 0; i < size - shiftBy; i++)
  17. {
  18. temp = myarray[i];
  19. myarray[i] = myarray[i + shiftBy];
  20. myarray[i + shiftBy] = temp;
  21. }
  22.  
  23. }
  24. }
  25. int main()
  26. {
  27. int a;
  28. char buff[10000];
  29. char*word = new char[strlen(buff) + 1];
  30. cin.getline(buff, 10000);
  31. cin >> a;
  32. for (size_t i = 0; i < strlen(buff); i++)
  33. {
  34. if ((buff[i] >= 'A' && buff[i] <= 'Z') || (buff[i] >= 'a' && buff[i] <= 'z'))
  35. {
  36. for (size_t j = i; (buff[j] >= 'A' && buff[j] <= 'Z') || (buff[j] >= 'a' && buff[j] <= 'z'); j++)
  37. {
  38. char*word = new char[strlen(buff) + 1];
  39. strncpy(word, buff, j + 1);
  40. }
  41. shiftLeft(word, i, a);
  42. cout << word[i];
  43. }
  44. }
  45. system("pause");
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement