I'm confused on where to start.


I'm creating an application that can analzye numeric data contained in an single-dimension array of type integer. I have the skeleton key below but i'm not sure where to begin.

ArrayClass {
private:
int *theArray;
int theArraySize;


public:
ArrayClass(int [], int);
int sum(void);
int countNmbrsBigger(int);
int average(void);
int high(void);
int low(void);
int find(int);
};

ArrayClass::ArrayClass(int anArray[], int ArraySize){
//constructor
theArray = anArray;
theArraySize = ArraySize;
}


int ArrayClass::low(void){
//find the lowest value in the array
int lowValue = theArray[0];
for (int i = 0; i < theArraySize; i++){
if (theArray[i] < lowValue){
lowValue = theArray[i];
}
}
return lowValue;
}
It's just a class.
You'll need a main-function which calls the constructor and function(s) of this class.

1. generate an object of ArrayClass like
ArrayClass ac (array, size);

2. call the function of this object
int anInt = ac->low();
Last edited on
Topic archived. No new replies allowed.