int main()
{
int shiftSteps, newposition;
int numbers[10], numberscopy[10];
cin >> shiftSteps;
for (int i = 0; i < 10; i++)
cin >> numbers[i];
for (int i = 0; i < 10; i++)
numberscopy[i] = numbers[i];
//----------------------------------------
for (int i = 0; i < 10; i++)
{
newposition = (i + shiftSteps) % 10;
numbers[newposition] = numberscopy[i];
}
for (int i = 0; i < 10; i++)
cout << numbers[i] << " ";
}
I wrote this code to rotate 10 numbers to Right with auxiliary array "numberscopy", but i want to rewrite the code without auxiliary array and i don't know how.