Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

help with c++ questions?

im trying to write code that move my element forward, like if i have input 5,4,3,2,1 then it gives me 1,5,4,3,2

and i m using arrays thanks

1 Answer

Relevance
  • Anonymous
    1 decade ago

    What part are you having trouble with?

    const int size = 5;

    int array[ size ] = { 1, 2, 3, 4, 5 };

    int arraycopy[ size ];

    for ( int i = size; i > 0; --i )

    {

    arraycopy[ i ] = array[ ( i + 1 ) % size ];

    }

Still have questions? Get your answers by asking now.