returning mode value from array
I have an idea of how I want to tackle this but its hard for me to implement in code. I want the function to check each element and if it spots another one just like it, to do an incrementation. I need a nudge. I'm not sure how to take that first step. Any help as always is appreciated.
Code:
#include <iostream>
using namespace std;
int mode(int a[],int size );//prototype
int main()
{
const int size=10;
int a[size]={1,2,-3,-4,-5,-6,7,8,-9,10};
mode(a,size);//call
return 0;
}
int mode(int a[], int size) //returns mode element of array
{
int m=0;
for(int i=0;i<size;i++){
if(i //????????
a[i];
}
}