title: Finding Mode of Vector of Ints in C++
body: <p>So I'm trying to make a basic program to learn the basics of C++, I'm generating 100 random numbers from 0 to 100 and storing them in a vector, I am then displaying the sum, mean, median, mode, high and low of the vector. I have everything else done except the mode which is where I get stuck. Here is the code I have so far.</p>
  
  <pre><code>int modeFunction()
       {
           numMode = 0;
           count = 0;
           for (int n = 0; n &lt; 100; n++)
           {
               for (int y = 0; y &lt; 100; y++)
               {
                   if (numVector.at(y) == numVector.at(n))
                  {
                      numMode = numVector.at(y);
                      count++;
                  }
               }
  
           }
           return numMode;
       }
  </code></pre>
  
  <p>After that I get stuck because in my mind that should work but it doesn't. It just out puts the last number, usually 100. Any help would be much appreciated.</p>