Use code tags: code] /code] Put code between that and it'll be easier to read as you'll see.
Just start them off with [ (which I didn't so that it doesn't convert it). To bring it up, simply press the <> box (top left) on the left of the text box under "Format:" when you're replying.
First off, you're making the function call itself at the end! You're constantly creating new variables "input" and "i" every time you call the function and the old ones aren't destroyed.
What would be better is this (and this is what code looks like with code tags!):
int random = rand()%X*Y+1;
By using a loop instead, when the function "cycle" ends, the variables die and the memory is free to reuse. Unlike what you were doing, the function would NEVER end, leaving the variables using memory space while never going to be used. Then it would call itself over and over, piling up unused variables after each iteration!
Also, your integer "random" is never used.
The reason the program loops through multiple times if you input multiple characters is because cin takes in all input until it reaches white space. So if I input "saas", input will equal 's' and it'll go through. However, in the buffer, there's still "aas". So the next time it goes to cin >>, it'll see that there's already input there waiting to be used and it'll grab that instead of waiting for input from the user and input will equal 'a'. So it's not repeating for every input given, it's going through the program normally and then using the input left in the buffer instead of waiting for input from the user.
You can get rid of the extra input if you want, or you can leave it as is so that you can move the "S" several times in one go.
A good thing to do would be to add a "default" case for your switch that lets the user know they inputted a wrong value.
Anyway, good job! ^-^