-
error in Insertion_Sort
Code:
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int findSmallestRemainingElement (int array[], int size, int index);
void swap (int array[], int first_index, int second_index);
void sort (int array[], int size)
{
for ( int i = 0; i < size; i++ )
{
int index = findSmallestRemainingElement( array, size, i );
swap( array, i, index );
}
error msg:undefined reference to'findSmallestRemaingElement(int*,int,int)'.
No other error inthis program.Where is the error?.
-
You need to implement that function.
Code:
int findSmallestRemainingElement (int array[], int size, int index) {
// do your thing here
}
-
Sir,
I still do not undertand. Could you pl be more detailed. I am 77+ and beginner. Would appreciate all help.thanks.KB Iyer
-
Wait, you mean you are at least 77 years old?
That immediately makes me think of this article: Coding Horror: Please Don't Learn to Code
So, did you see the three line example Salem gave? That's what you need to add to start with. Then you write the code for "do your thing here". You'll also need to write the swap function if you haven't done so already.
We aren't going to write it for you, so get started on it and show us how you went.