Selection Sorting

1) Program a C++ function for selection sorting, selectSort(int mX[], int size), that receives an array and its size as arguments, and sorts the given array, by selection sort algorithm.

2) Program a C++ function, printArray(int mX[], int size, int printSize), that prints out the first printSize(or the total number elements) and the last printSize elements of the given array, before sorting and after sorting.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  Use following main() function.
main() function
void printArray(const int mX[], int size, int printSize);
void selectionSort(int mX[], int size);

void main()
cout << "Before sorting:" << endl;
printArray(rn, SIZE_R, 100);[output][/output]
statArray(rn, SIZE_R, max, min, avg, var, st_dev);
cout << endl;
cout << "max: " << max << ", min: " << min << ", avg: " << avg
<< ", var: "<< var << ", st_dev: " << st_dev << endl;
cout << endl;
selectionSort(rn, SIZE_R);
cout << "After sorting:" << endl;
printArray(rn, SIZE_R, 100);

Topic archived. No new replies allowed.