Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- void shiftLeft(char myarray[], int size, int shiftBy)
- {
- if (shiftBy > size){
- shiftBy = shiftBy - size;
- }
- if (size == 1){
- }
- else{
- char temp;
- for (int i = 0; i < size - shiftBy; i++)
- {
- temp = myarray[i];
- myarray[i] = myarray[i + shiftBy];
- myarray[i + shiftBy] = temp;
- }
- }
- }
- int main()
- {
- int a;
- char buff[10000];
- char*word = new char[strlen(buff) + 1];
- cin.getline(buff, 10000);
- cin >> a;
- for (size_t i = 0; i < strlen(buff); i++)
- {
- if ((buff[i] >= 'A' && buff[i] <= 'Z') || (buff[i] >= 'a' && buff[i] <= 'z'))
- {
- for (size_t j = i; (buff[j] >= 'A' && buff[j] <= 'Z') || (buff[j] >= 'a' && buff[j] <= 'z'); j++)
- {
- char*word = new char[strlen(buff) + 1];
- strncpy(word, buff, j + 1);
- }
- shiftLeft(word, i, a);
- cout << word[i];
- }
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement