hey everyone,
so i need help. we're suppose to write a program that reads a file of odd values and another of even values and calculte the mean and median of each file.
i'm very new to all this so i dont even know where to start. Please healppppp
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
I am really lost! sorry if i angered you but i wasn't trying to get my hw done by someone else, i'm trying to figure this out. i also have to understand this because i have to write an IPO.
I didnt close the file yet, i'm going to do that in a separate output_func
ifstream input_stream; // global variables. Avoid them. Pass locals by reference to functions instead.
ofstream output_stream;
void fillArray (double values_array[], int array_size, int& length);
void bubbleSort (double values_array[], int length);
double calcMedian (double values_array[], int array_size);
double calcMean (double values_array[], int array_size, int length);
// length here, array_size there. used inconsistently
int main()
{
double values_array[array_size]; // What is array_size? It must be a compile-time const.
int length;
fillArray (values_array); // no file is open yet. Does the argument-list match function's declaration?
bubbleSort (values_array, length);
input_stream.open ("FileA.txt"); // too late
if ( input_stream.fail() )
cout<< "Input file opening failed. \n"; // only statement within if
exit(1); // return 1; exit is harsh and unnecessary
}