This prelab exercise tests your knowledge of function overloading.
For a review, click here to go to "CS115 C++ Overloading Lab".In summary, you can define functions with the same name but with different parameter types or different number of parameters. When you do this, you can say that you have overloaded a function.
For instance, given the following prototypes,void timesTwo(int &num); void timesTwo(double &num);you can see that the function timesTwo is overloaded (because the first prototype has an int parameter and the second has a double parameter).
void stradd(char *s1, char *s2);
Which of the following overload stradd?
int average(int array[], int size); { int total=0; //set total to 0 for (int j=0; j<size; j++) //for every array member, total+=array[j]; //add it to total return total/size; //average (as integer) }Overload the function so that it averages arrays of type long.
|
|
|