Implement a C++ program to sort a list of integers using the selection sort algo
ID: 641082 • Letter: I
Question
Implement a C++ program to sort a list of integers using the selection sort algorithm. You are required to use an integer vector to store the input numbers typed from the keyboard. The declaration of this vector will be in main().
Must implement:
a separate function readData() to read numbers from the keyboard.
a separate function called selectionSort(), which will be called by the main() function to sort the afore-mentioned vector;
a function printVector() to print out the content of the vector, this function will be called by main() right after calling readData() and selectionSort(), respectively, to print out the vector content before and after being sorted.
Explanation / Answer
#include int main() { int array[100], n, c, d, position, swap; printf("Enter number of elements "); scanf("%d", &n); printf("Enter %d integers ", n); for ( c = 0 ; cRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.