Hi
im now trying to work on calculating the mean, were by the array is arranged into size order, and the the median is printed out, i am having problems with the code, the cmd.exe flashes open then shut again, i am not recieving any errors, any ideas. im using visual studio C++ 2010
Code:
#include <stdio.h>
#define Size 11
int main()
{
float median[]={13, 36, 16, 21, 24, 16, 21, 10, 18, 16};
int x;
int y;
float temp;
int stop;
for(x=0; x<Size; x++)
{
for(y=x+1; y<Size; y++)
{
if(median[y]>median[x])
{
temp=median[x];
median[x] = median[y];
median[y] = temp;
}
}
}
if(Size%2==0)
return printf("%f\n",(median[Size/2]+median[Size/2-1])/2);
else
return printf("%f\n",median[Size/2]);
}