Need C++ Code and Screenshot of Output

1. Write a C++ program that complete the following tasks: a) Define a value-return function that returns the average of an array of int (you need to set an array as a parameter, and another int parameter for the size of the array). b) Declare an array of int named a and fill in the array with 30 random numbers between 0-100, using random seed 7. (Do not print the numbers yet). Call the function you defined in (1) to find the average of the numbers in a. Declare another array of double named b and store the differences between the elements in a and the average. c) d) Output the original numbers, the average and the differences in the following format: Array a Average Array b 61 50 65 56.77 56.77-6.77 56.778.23 4.23

1. Write a C++ program that complete the following tasks: a) Define a value-return function that returns the average of an array of int (you need to set an array as a parameter, and another int parameter for the size of the array). b) Declare an array of int named a and fill in the array with 30 random numbers between 0-100, using random seed 7. (Do not print the numbers yet). Call the function you defined in (1) to find the average of the numbers in a. Declare another array of double named b and store the differences between the elements in a and the average. c) d) Output the original numbers, the average and the differences in the following format: Array a Average Array b 61 50 65 56.77 56.77-6.77 56.778.23 4.23



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *