I'm trying to take an array of n user defined values and write 2 functions...one that shows the value of this array and one that reverses the order of the values of the array. HEre are my two functions:

Code:

void show_array(double ar[], int n)
{
for (int i = 0; i < n; i++)
{
cout << "Value #" << (i + 1) << "= ";
cout << ar[i] << "\n";
}
}
void reverse_array(double ar[], int n)
{
double temp;
for (int i = 0; i < n; i++)
{
temp = ar[i];
ar[i] = ar[i + (n- 1)];
ar[i + (n - 1)] = temp;
}
}

My problem is that let's say a 3 element array is given the following values: ar[0] = 3, ar[1] = 2, and ar[2] = 1, the show_array function displays the following values: 1 (which is right), 8.59976e-298 (very wrong), and1.39068e-309 (even more wrong)...any idea why this isn't doing what I'd like it to...? Thanks -Chap