1. Flipping an array

Write a program that flips (i.e. prints backwards) a sequence of integers. Your program should first ask the user how large the sequence is and the read the sequence. In the end it should print the sequence from end to beginning.

Example run:
How many integers will you give me: 5
Enter the sequence of 5 integers:
6 7 8 9 10
10 9 8 7 6
You must use dynamic memory allocation to make your program work with any sequence size.

2. Shifting an array

Write a program that cyclically shifts a sequence of integers some specified number of positions to the right. To make this more precise, your program should first ask the user how many integers there are in the sequence. Then it should read the integers from standard input. Then it should ask how many positions to the right the sequence should be shifted and finally it should produce the shifted sequence.

For example, a typical run would look like this:
How many integers will you give me: 5
Enter the sequence of 5 integers:
6 7 8 9 10
How many positions to the right should it be shifted?: 2
9 10 6 7 8
What I'm asking here is that you move each element x positions to the right, where x is the number of positions the user selects. The first positions are to be filled with the x last elements of the original sequence. BE CAREFUL not to write outside the array and to use dynamic memory allocation. A program which only uses as much space as needed to store the sequence only will receive extra credit.

What to submit

For both programs you should submit to me by email the source code (i.e. the .cpp files). Your programs don't have to interact with the user in exactly the way shown above, but it must be obvious how to use them without reading the code.