title: How to shift an array to left or right in c++?
body: <p>I have an array <code>a[]={1,0,0,0,0};</code> and I want to rotate it so it ends up like this: <code>a[] = {0,0,0,0,1};</code></p>
  
  <p>how can I shift one element to the left or more then one?</p>
  
  <pre><code>#include&lt;iostream.h&gt;
  
  int main ()
  {                      
       int temp,a[] = {1,0,0,0,0};              
       for(int i =0;i&lt;=4;i++)
       {
          temp = a[0];
          a[i] = a[i-1];
          a[4] = temp;  
          cout &lt;&lt; a[i];
       }
      system("pause");
      return 0;
  }
  </code></pre>