Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions