# include <iostream>
using namespace std;
void init(int *Ptr, const int &s);
void display(int *Ptr, const int &s);
void sort(int *aPtr, int s);
void swap(int *v1Ptr, int *v2Ptr);
int index_of_next_smallest(int *aPtr, int *SiPtr, int s);
int main()
{
int size, count;
int *nPtr;
cout << "Enter the size: ";
cin >> size;
nPtr = new int[size];
init(nPtr, size);
display(nPtr, size);
sort(nPtr, size);
cout << endl;
display(nPtr, size);
char ch;
cin >> ch;
}
///////////////////////////////////////////
void init(int *Ptr, const int &s)
{
for(int x=0; x<s; x++)
{
*Ptr++=rand()%101;
}
}
///////////////////////////////////////////
void display(int *Ptr, const int &s)
{
int x=0;
while(x<s)
{
cout << *Ptr++ << " ";
x++;
}
}
////////////////////////////////////////////
void sort(int *aPtr, int s)
{
int *ionsPtr;
int *indexPtr=aPtr;
for(int index=0; index<s-1; index++)
{
ionsPtr=index_of_smallest(aPtr, indexPtr, s);
swap(indexPtr, ionsPtr);
indexPtr++;
}
}
////////// /////////////////////////////////
void swap(int *v1Ptr, int *v2Ptr)
{
int temp;
temp=*v2Ptr;
*v2Ptr=*v1Ptr;
*v1Ptr=temp;
}
/////////////////////////////////////////////
int index_of_next_smallest(int *aPtr, int *SiPtr, int s)
{
int min=indexPtr, index_of_min=indexPtr;
for(int index=indexPtr+1; index<s; index++)
if(indexPtr<min)
{
min=indexPtr;
index_of_min=indexPtr;
}
return index_of_min;
}
this is my code and i have a little compile error that i cant seem to fix if someone can help me that would be appreciate