I've been at this code for the past 6 or 7 hours. I'm down to one last error and can't figure out what's causing it. Please advise! Thanks

#include <iostream> #include <fstream> #include <iomanip> #include <string> #include <cmath> using namespace std; double Calc_Average (int Size, double input[]); double Calc_Median(int Size, double input[]); double Calc_Std_Deviation (int Size, double average, double input[]); double Calc_Variance (int Size, double average, double input[]); void SortArray (int Size, int numbers_used); int main() { double count[Size]; const int Size = 11; double median; double average; double std_deviation; double variance; string text_file; ifstream in_size ("numbers.txt"); if (in_size.is_open()) { while (in_size.good()) { cout << "Enter the file to read in:" << endl; getline(cin, text_file); cout << "The numbers in the array are:" << endl; if(in_size.fail()) cout << "Error opening file" << endl; for (int index = 0; index < Size; index++) { in_size.close(); } SortArray(count, Size); average = Calc_Average ( count, Size); median = Calc_Median (count, Size); std_deviation = Calc_Std_Deviation (count, Size); variance = Calc_Variance (count, Size); cout << "The average of the numbers is " << average << endl; cout << "The median of the numbers is " << median << endl; cout << "The standard deviation is " << std_deviation << endl; cout << "The variance is " << variance << endl; return 0; } } } double Calc_Average(int Size, double input[]) { double sum = 0; double average = 0; for (int i = 0; i < Size; i++) { sum = sum + input[i]; average = (sum/ Size); } return average; } double Calc_Median (int Size, double input[]) { int median_td; double median; if(Size % 2 == 0) { median_td = (Size + 1)/2; median = input[median_td]; } else { median_td = Size/2; median = input[median_td]; } return median; } double Calc_Std_Deviation(int Size, double average, double input[]) { double sum = 0; double std_deviation = 0; double numerator = 0; double denominator = Size-1; //finds the sum of the array items for(int i= 0; i < Size; i++) { sum += input[i]; //finds the standard deviation for (int i = 0; i < Size; i++) { numerator = numerator + pow((input[i] - average), 2); } std_deviation = sqrt(numerator/denominator); return std_deviation; } } double Calc_Variance(int Size, double average, double input[]) { double numerator = 0; double denominator = Size-1; double variance; //finds the variance for (int i = 0; i < Size; i++) { numerator = numerator + pow((input[i] - average), 2); variance = (numerator/denominator); return variance; } }

MOD EDIT: When posting code...USE CODE TAGS!!!

This post has been edited by **JackOfAllTrades**: 14 December 2010 - 05:53 AM