Hello, I was wondering how I could correct this. It is referring to the following line:
set.quickSort(prt1, 0, arraySize-1);
I tried to create an object and call the function this way but I am not sure how to correct this error.
My code is the following:
bool Sort::test()
{
Sort set();
bool answer = false;
//int arraySize;
cout << "Enter the size of the array: ";
//cin >> arraySize;
cout << "50";
arraySize = 50;
cout << "Array being randomly populated with integers.";
// pointers add/change values in the array indirectly
int *prt1=new int[arraySize];
// randomize the random number generator using current time
srand ( (unsigned)time ( 0 ) );
//insert numbers into array
for (int i=0; i<arraySize; i++)
*(prt1 + i)= 1 + rand() % 1000;
//*(prt2 + i)= *(prt3 + i) =
//print the numbers
cout << "\n\nThe numbers before sorting are:\n";
for (int i=0; i<arraySize; i++)
cout << *(prt1 + i) << "\t";
set.quickSort(prt1, 0, arraySize-1);
//print the sorted numbers
cout << "\n\nThe numbers after sorting are: \n";
for(int i=0; i<arraySize; i++)
cout << *(prt1 + i) << "\t";
// test
if(*(prt1 + 1) < *(prt1 + 2))
{
answer = true;
}
else
return answer;
}