Hello mitrmkar,
Thanks for the pointer; I never thought that such info out there. I mod the code and it work, except the last part did work right, it suppose to display [display] Fun isn't it? [/display] but it display
?Fiinnsttu
, and how can I get around without using the #include <algorithm> instructor might not like it if I use it
#include <iostream> #include <algorithm> int main() { using namespace std; int arr_size = 13; int arr[] = {80, 127, 120, 42, 115, 125, 120, 49, 126, 42, 115, 126, 73}; cout << "Display numbers in the array before sort" << endl; for(int i=0; i < arr_size; i++) cout << " Integer [arr]: " << arr[i] << endl; cout << endl; sort(arr, arr + arr_size); cout << "Display numbers in the array after sort" << endl; for(int i=0; i < arr_size; i++) cout << " Integer [arr]: " << arr[i] << endl; //Calculate the average value double total = 0.0; for(int i = 0; i < arr_size; i++) total += arr[i]; double ave = total / arr_size; //report the results cout << " Average value = " << ave << endl; //Display numbers above the average cout << "Display number above average" << endl; for(int i=0; i < arr_size; i++) if(arr[i] > ave) cout << " Integer [arr]: " << arr[i] << endl; //Display numbers below the average cout << "Display number below average" << endl; for(int i=0; i < arr_size; i++) if(arr[i] < ave) cout << " Integer …