Question: in c++ please and thank you Write a program to sort the elements in array using selection sort algorithm. Your selection sort algorithm should be
Write a program to sort the elements in array using selection sort algorithm. Your selection sort algorithm should be a function as a bsiun. void SelectionSort (int [], int numRecords ): You should get the elements of the array from the user. Lets assume the size of the array is 10 . The number of elements should not be greater than the size of the array. Do an Input validation check here Cali the selection sort function with the populated array Finaliy display the sorted elements. Here is a sample run. (Keep prompting the user until the number of elements is less than 11. How many elements? 15 The number of elements should be lesy than 11 or greater than 0 How many elements? 4 Enter the elements: 1245.2314 The gorted array 18 : 12142345 main cpp Lasid defaut tentplate 1 minclude ciostream 2 using ninespoce std; -define sIze 10 void selectionsort(int [], int size ); int =sin() I/ oeclore otl the vartables and arroys I/ input volidation II Nead data fron Reyboerd and populote arrays If call the selection sort function 1/ setectionsort (numberi ist, nubernec): oisploy the sorted orray void selectionsort (int nunbers[l, int size) I/ body of the function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
