Here is the error:
cannot convert parameter 1 from 'int *' to 'int *[]'
here is my code:
#include <iostream>
using namespace std;
void findMode( int *, int, int);
void selectionSort(int *[], int);
int main()
{
int *numbers; //dynamically allocate an array
int elements, //holds the number of inputs
count, //counter
largest = 0; //largest input
//get the amount of numbers being calculated
cout << "How many numbers do you wish in input?";
cin >> elements;
//Dynamically allocate anarray large enought to hold
//the amount the uder had input
numbers = new int[elements];
//enter the numbers being calculated
cout << "Enter the numbers you would like to find the mode of: \n";
for (count = 0; count < elements; count++)
{
cout << "Intput number " << (count +1) << ": ";
cin >> numbers[count];
}
//find the largest number
for (count = 0; count < elements; count++)
{
if ( *(numbers + count) > largest)
largest = *(numbers +count);
}
//Sort the values
[B][U]selectionSort(numbers, elements);[/U][/B]
//find the mode
findMode(numbers, elements, largest);
return 0;
}
//***********************************
//takes in the array of numbers and *
//Sorts the numbers in ascending *
//order in the array *
//***********************************
void selectionSort(int *array[], int size)
{
int startScan, minIndex;
int *minElem;
for (startScan = 0; startScan < (size-1); startScan++)
{
minIndex = startScan;
minElem = array[startScan];
for(int index = startScan + 1; index < size; index++)
{
if (*(array[index]) < *minElem)
{
minElem = array[index];
minIndex = index;
}
}
array[minIndex] = array[startScan];
array[startScan] = minElem;
}
}
void findMode(int *array, int size, int large)
{
int array2[large];
int count;
int x;
int mode = 0;
for (count = 0; count < size; count++)
{
x = array[count];
array2[x] = array2[x]++;
}
for ( count = 0; count < size; count++)
{
if (array2[count] > mode)
mode = count;
}
cout << "The mode is: " << mode << endl;
}
the error says it conflicing but im not sure what to change to make it work