the quick and easy method would be just to use the reverse( ) function from the <algorithm> library:
Code:
reverse(&list[0], &list[5]); //pass in the first element and last element of the range of the array to be sorted
cout << "In reverse order: ";
for(int i=0; i<5; i++)
cout << list[i] << " ";
using the swap( ) function from <algorithm>
Code:
for(int i=0, j=array_size; i<array_size/2; i++, j--)
swap(&list[i], &list[j]);
or.. write your own reverse algorithm:
Code:
for(int i=0, j=array_size, temp; i<array_size/2; i++, j--)
{
temp = list[i];
list[i] = list[j];
list[j] = temp;
}
jmd15's method below is probably a more efficient method of what you are wanting to do though
code == good; //