title: Length of a growing sequence C++
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  const int MAX_SIZE = 20;
  
  int main()
  {
      int n, a[MAX_SIZE]; // initialize array and its size
      cin &gt;&gt; n;                       //
      for (int i = 0; i &lt; n; i++)     //  ===&gt; array input
          cin &gt;&gt; a[i];                //
      int max = 0;    // initializing a variable indicating the length of the longest sequence
      int i;
      int current = 0;    // makes sure the each loop begins from where the last has concluded 
      do
      {
          int count = 0; // counter indicating the length of the sequence.. resets after each loop
          for (i = current; a[i] &lt;= a[i + 1] &amp;&amp; i &lt; n - 1; i++) // loops until a lower than the previous number is found or the array ends
          {
              count++;
          }
          current = i;    // makes so that the next loop can start from where the last has concluded
          if (count &gt; max) max = count;   // determines the longest "growing" sequence of numbers
      } while (i &lt; n);    // when all of the array elements are checked the program is done
      cout &lt;&lt; max &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>My commenting skills suck so don't be too hard on me. I've tried to explain as clearly as possible what I want to accomplish with my code as of misunderstandings in my previous questions.</p>
  
  <p>TL;DR: To sum it up, this is (or at least should be) a program which finds the longest sequence length of "growing" numbers in an array. What does "growing" mean? A sequence in which every next number is either even or higher than the previous one. For example in <code>1 2 3 3 1 2</code> the "growing" sequence is <code>1 2 3 3</code> and its length (what should the output be) is 4. However, for some unknown reason, when I compile and input the array the program freezes without giving any output.. ever. Any ideas what could possibly cause that? Thanks for the help in advance !</p>