title: C++ Calculating the Mode of a Sorted Array
body: <p>I have to write a C++ code that finds the median and mode of an array. I'm told that it's much easier to find the mode of an array AFTER the numbers have been sorted. I sorted the function but still cannot find the mode. </p>
  
  <pre><code> int counter = 0;
      for (int pass = 0; pass &lt; size - 1; pass++)
          for (int count = pass + 1; count &lt; size; count++) {
              if (array [count] == array [pass])
                  counter++;
              cout &lt;&lt; "The mode is: " &lt;&lt; counter &lt;&lt; endl; 
  </code></pre>