example of array

How to write a program that prompts the user to input N numbers and save them in an array. The program
should do the following:

  1. Print the numbers as in the sample Input/Output.
  2. Pprompt the user to enter an integer value K < N, the program will then shift the array
    elements K positions to the right, while the last K elements are moved to the beginning of
    the array.
    For example: if we have an array [1 2 3 4 5 6 7 8], shifting 2 positions to the right should
    give the array [7 8 1 2 3 4 5 6]?

It’s pretty easy to do, if you create a second array, iterate over the elements in the first array with a for-loop, and save the elements at the correct destination in the second array.
If you are new to programming, you should definitely try this.

For advanced usage:
Shifting the array is usually called rotating. And since this is a quite common operation, there’s already an implementation for it: std::rotate

Is this problem on CodeChef? If not, it seems like it could be worked up into a good introductory problem.

//