Lab 8 - Passing Arrays to Functions
In this lab, we will convert Question 2 from Homework 4
to use functions instead of doing everything in main(). Three functions will
be defined as follows:
- get_input() will take the array and the size. It will prompt the user for
the number of elements, verify that the number is between 2 and MAX_SIZE and
read the elements from the keyboard.
- calc_average() will take the array and the size. It will return the
average.
- calc_stdev() will take the array and the size. It will call
calc_average() to get the average and then calculate the standard deviation.
It will then return the standard deviation.
Your main() function will declare the array (do not have a global array). In
main(), create a do-while loop that will call get_input(), calc_average() and
calc_stdev(). It will then print out the average and standard deviation. Then
it will prompt the user if they wish to enter another set of data. Exit the
do-while loop when the user responds with "no" or 'n'. Make sure to clear
the input stream after reading their response.