title: printing a array values in ascending and descending order in c++
body: <p>I wrote this below program to print the array by getting i/p from user but shows a compiling error.  And i want a program print those input in ascending and descending order.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  int main()
  {
      int a[10] = {};  // ![enter image description here][1]
      for (int i = 0; a[i] &lt;= 9; i++)
        {
          cout &lt;&lt; "Enter the numbers:" &lt;&lt; endl;
          cin &gt;&gt; a[i];
        }
      cout &lt;&lt; a[i] &lt;&lt; endl;
  }
  </code></pre>
  
  <p><strong>error:</strong></p>
  
  <pre class="lang-none prettyprint-override"><code>![error by codeblocks][1]
  
  ||=== Build: Debug in example (compiler: GNU GCC Compiler) ===|
  H:\c++\example\main.cpp||In function 'int main()':|
  H:\c++\example\main.cpp|12|error: name lookup of 'i' changed for ISO 'for' scoping [-fpermissive]|
  H:\c++\example\main.cpp|12|note: (if you use '-fpermissive' G++ will accept your code)|
  ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
  </code></pre>