title: How to take inputs using "range based for loop"
body: <p>The loop containing &quot;cin&quot; doesn't change the values. What is happening inside the loop? And how can I use this(range based loop) to take inputs?</p>
  <p>INPUT:-</p>
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      int arr[]={1,2,3,4,5};
  
      //with outputs/cout it work properly
      for(auto x:arr)
      {
          cout&lt;&lt;x&lt;&lt;&quot; &quot;;
      }
      cout&lt;&lt;endl;
  
  
      //Now suppose, I want to change them
      for(auto x:arr)
      {
          cin&gt;&gt;x;
      }
  
      //now again printing
      for(auto x:arr)
      {
          cout&lt;&lt;x&lt;&lt;&quot; &quot;;
      }
  }
  </code></pre>
  <p>OUTPUT:-</p>
  <pre><code>1 2 3 4 5
  9 8 7 6 5
  1 2 3 4 5
  </code></pre>