I am having trouble finishing this code for an assignment i have due. I have to create a code that (depending on what the user picks) sorts the numbers in ascending or decending order using an array with the funcion in the code. Any help would be greatly appriciated.
using namespace std;
void sortMe(int array,int sortedIndexes , int size, char mode);
const int size=10;
cout<<"Please press (a) for ascending or (d) for decending order."<<endl;
I'll point out the obvious. One, this doesn't compile. Two, sortMe is not written. Am I correct in assuming that this is the code you have been GIVEN and the task is to change it so things work? If so, you're going to have to ask a specific question and show effort. Otherwise it's considered a homework dump.
A good start would be to write a sortMe function that does nothing but print out that it was called as a temporary debugging mechanism. Then write some code that actually calls the function with the right parameters, particularly the mode. Then look at line 19. You have a for-loop that goes through an array. Looks like something that is part of a sort, so stick it in your sorting function and finish writing the sorting code there, not in main. Finally, what is sortedIndexes? The sorting parameters seem off. Seems like you're passing TWO arrays, not one, to the function. Most sorting procedures have you pass only one. Find out precisely what you're supposed to do with that sortedIndexes.