This is the sample output of the question.My swapping part is not functioning well...
int *smallest, *current = array;
for(int i=0; i<MAX-1; i++, current++){ //partial code given by the question
smallest = current;
cout << "\nCurrent=" << *current;
int tmp = *current;
for(int j = i; j < MAX; j++,smallest++){ //my code
if(*smallest < tmp){
tmp = *smallest;
}
}
*smallest = tmp;
cout << " Smallest=" <<*smallest<< endl;
int tmp2; //not functioning from this line onwards
tmp2 = *smallest;
*smallest = *current;
*current = tmp2;
}