I searched the board but didn't find anything but two threads and neither were to helpful.
How would I take an array of integers (or anyother type of numerical data type) and sort the numbers from least to greatest and place them back into the array in least to greatest order?
Change a < b to a > b in order to sort greatest to least.
bool order (int a, int b)
return (a < b);
int main (void)
const int len = 25;
// let's say we filled array with random values =)
std::sort<int*>(array, array + len, order);
you know something..why am i always doing things the hard way...is there a book or something that shows us all the built in std functions, etc? i am always writing my own classes, functions, etc to do sort, etc..etc..please give me link or a good book
It's good practice that you're writing the algorithms, but there are easy ways out :D