selection sort

trying to call the function in ascending order i can't seem to get the output
complier says something about "arrSelectionSort idenifier not found"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "stdafx.h"
#include <iostream>
using namespace std;

void arrSelectSort(int [], int);
int main()
{
	const int SIZE = 8;
	int num[SIZE] = { 35, 10, 40, 5, 20, 15, 30, 25 };
	
	
	cout << "Selection method, sorted in ascending order: \n";
	arrSelectionSort(num, SIZE);
		
}
void arrSelectSort(int array[], int size)
{
	int startScan, minIndex;
	int minValue;

	for (startScan = 0; startScan < ( size - 1 ); startScan++)
	{
		minIndex = startScan;
		minValue = array[startScan];
		for(int index = startScan + 1; index < size; index++)
		{
			if((array[index]) < minValue)
			{
				minValue = array[index];
				minIndex = index;
			}
		}
		array[minIndex] = array[startScan];
		array[startScan] = minValue;
	}
}
Last edited on
Line 13: arrSelectionSort should be arrSelectSort. Look at name of your function.
make sure all your function names match up
Again you didn't print them.
Topic archived. No new replies allowed.