Question: Write a complete C + + program with a f unction called arrayFun that takes an 1 D integer array of user - specified size

Write a complete C++ program with a f
unction called arrayFun that takes an 1D integer array of
user-specified size and finds the sum,
average, and largest and smallest of the numbers stored in the array.
Create an integer array and initialize it to random integers in the main f
unction.
Pass this array to arrayFun and print the results of the arrayFun operations to the monitor.
Example main f
unction that uses arrayFun:
int main(){
int size;
cout << "How many numbers to enter? ";
cin >> size;
int nums[size];
cout << "Enter numbers: ";
for(int i =0; i < size; i++){
cin >> nums[i];
}
arrayFun(nums, size); // prints sum, average, largest and smallest of elements in nums
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!