map operations(find most occurence element)
<p>here is code</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;map&gt;
using namespace std;
int main(){
map&lt;int ,int&gt;a;
    map&lt;int,int&gt;::iterator it;
    int b[]={2,4,3,5,2,6,6,3,6,4};
     for (int i=0;i&lt;(sizeof(b)/sizeof(b[0]));i++){
         ++a[b[i]];
     }
    // for (it=a.begin();it!=a.end();it++){
        // cout&lt;&lt;(*it).first&lt;&lt;" =&gt;"&lt;&lt;(*it).second&lt;&lt;"\n";
     //}
     int max=a.begin()-&gt;second;
     for (it=a.begin();it!=a.end();it++){
         if ((*it).second&gt;max){
             max=(*it).second;
         }
     }
     for (it!=a.begin();it!=a.end();it++){
         if ((*it).second==max){
             cout&lt;&lt;(*it).first&lt;&lt;"\n";
         }
     }




      return 0;
}
</code></pre>

<p>what i am trying is following  according to  number of occurence of each keys   i  want it print  element which occurs most often in this case 6 but it does not show me result what is mistake?</p>
