I am currently working on a sorting list and I want to find the min, half and max from the sorted list. I have already sorted the list as follows:
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int arraySize = 7;
int a[arraySize] = {7, 77, 2, 4, 1, 9, 3};
int i, hold;
for (i=0; i<arraySize;++i)
for (int pass = 0; pass < arraySize-1; ++pass)
{
for (i=0; i<arraySize-1;++i)
{
if (a[i] > a[i+1])
{
hold = a[i];
a[i] = a[i+1];
a[i+1] = hold;
}
}
}
for (i=0; i<arraySize; ++i)
{
cout <<left
<< setw(2) << a[i];
}
cout << endl;
pause();
return EXIT_SUCCESS;
}
The final output should be: 1 4 77
Can somebody help me to find the min, half and max. Thankyou