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:
The final output should be: 1 4 77Code:#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; }
Can somebody help me to find the min, half and max. Thankyou



LinkBack URL
About LinkBacks


