I was attempting to tweak the selection sort code in C++ in order to test the results.
My updated code is as follows:
using namespace std;
cout<<"Enter number of elements\n";
cout<<"Enter elements of array\n";
This code is valid for certain arrays but not for others.
As an example:
When I input 1,11,2,22,3 as the array, I receive the correct result: 1,2,3,11,22.
However, if I enter the array as 1,11,2,22,3,33, I receive the same array as the input as the result.
Please let me know what's wrong with my code.