have been working on a program that should output the values of an array from lowest to highest order, my program runs but its ouputing -1.#IND which is clearly not right. Im pretty sure im messing up somewhere when i call back to my my function with selectionSort(array, N) but im not 100% sure. any help or suggestions would be appreciated. (code thus far).
#include <iostream>
#include <cmath>
using namespace std;
int main(){
double selectionSort(int a[], int size);
const int N = 8;
int array[N] = { 1, 3, 9, 0, 74, 36, 45, 2};
double results;
for( int i(0); i < N; i++){
results = array[i];
}
cout << "The order of the Array is: " << selectionSort(array, N) << endl;
system("PAUSE");
return 0;
}
void selectionSort(int a[], int size){
int m;
double hold;
for (int k=0; k<=size-2; k++){
m = k;
for(int j=k+1; j<size-1; ++j){
if (a[j] < a[m])
m=j;
}
hold = a[m];
a[m] = a[k];
a[k] = hold;
}
return;
}