Hello everyone,please i need help with this question.I have already written my code, its compiling but the answers are totally wrong, i dont know what the problem is. Here it is
Question:
Write down a statistics class which will have the following members;
• Real array with 90 elements;
• Real max, min and av,
• Integer arraysize
And the following member functions:
• Constructor ()
Will receive arraysize as a parameter with default value of 40
• Calculates the average of the array elements and saves in av
• Find and locates the min and max items in the array
• Destructor
And here is my own code;-
For me, your code doesn't compile. You need to declare i outside of the for loop at line 31.
After that... you need an array in statistics, with 90 elements, an array of preferably doubles (maybe publicly accessible?). After that, you don't need an array of statistics objects, and you won't need your elems in main(). You'd just have to do an.array[i] for your read in.
Also, keep arraysize. If you modify it at the start if the program and your loops run depending on its size, then you can keep a 90 element array but have it also "act" like a 20 element array.