Hi i have to do an assignment for class that want me to call by reference... i wrote one that builds and compose but when i run it it crashes.. so can someone please help me here?

Code:#include <iostream> #include <iomanip> #include <fstream> #include <math.h> using namespace std; void calcByRef(double [], int , double& , double& , double& , double& , double& ); int main () { double ar [15] = {2.4, 6.5, 1.2, 0.7, 15.3, 3.9, 78.1, 12.0, 5.4, 10.1, 24.0, 7.8, 46.8, 1.3, 0.1}; double high, low, avg, median, stdDev; int num; cout << "Results using references"; calcByRef(ar, num, low, high, avg, median, stdDev); cout << "Minimum: \t\t\t" << low << endl; cout << "Maximum: \t\t\t" << high << endl; cout << "Mean: \t\t\t" << avg << endl; cout << "Median: \t\t\t" << median << endl; cout << "Standard Deviation: \t\t\t" << stdDev << endl; return 0; } /********************************************************************************** Function: calcByRef Use: Uses the passed in array to calculate and pass back. Arguments: 1. ar2[]: the array that contains the second set of numbers. 2. num: Number of elements in the array. 3. low: The smallest number in the array. 4. high: The largest number in the array. 5. avg: The mean of all the elements. 6. median: The median number of the array. 7. stdDev: The calcualated standard deviation of the elements. Returns: nothing **********************************************************************************/ void calcByRef(double ar[], int num, double& low, double& high, double& avg, double& median, double& stdDev) { int i, a, b; double sum; low = ar[0]; high = ar[14]; for(i=0; i<15; i++) { sum += ar[i]; } avg = (double)sum / num; median = ar[num/2]; for(i=0; i<15; i++) { sum += i*i; a = sum; } for(i=0; i<15; i++) { sum += i; b = sum*sum; }