#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int getMiddleValue(const int *p,int size)
{
int counter[100] = {0};
for(int i = 0;i < size;++ i)
{
++ counter[p[i]];
}
int tempCounter = 0;
for(int i = 0;i < 100;++ i)
{
tempCounter += counter[i];
int data = size >> 1;
if(tempCounter > data )
return i;
}
return 0;
}
void main()
{
int a[5]= {1,10,30,28,99};
cout<<getMiddleValue(a,5);
system("pause");
}