title: Finding dominants in sorted array
body: <p>I have a problem with fragment of code. I want to find dominant among already sorted array. The thing is when there are two or more dominants in array, it only prints one. I mean situation like this:
  Numbers: 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5 &lt;- so the dominants should be 1, 2 and 3. I tried many times to fix it but i guess i blocked myself up. Could anyone give me some clue? </p>
  
  <pre><code>n- number of integers, initiated by user
  int t[n];
  
  ...generating random numbers, sorting...
  
  int actuall, max, dominant, occurency;  
  
   max = 0;
   for(int i = 0; i&lt;n; i++)
   {
     actuall= t[i]; 
     occurency = 0;
  
  for(int j = 0; j&lt;n; j++) 
  {
  if(t[j] == actuall) occurency++;
  }
  if(occurency &gt; max)
  {
    max = occurency; 
   dominant = actuall;      
    }           
  }
  
   if(max == 1){
   cout&lt;&lt;"\nThere is no dominant";
   }
  
   if(max &gt; 1) { 
   cout &lt;&lt; endl &lt;&lt;"Dominant: " &lt;&lt; dominant &lt;&lt;", occurency: " &lt;&lt; max &lt;&lt; endl;
   }
  </code></pre>