Home / Expert Answers / Computer Science / all-in-c-1-in-you-main-function-declare-an-integer-array-data-with-100-elements-2-write-pa873

(Solved): All in C++ 1. In you main( ) function, declare an integer array data[ ] with 100 elements. 2. Write ...




All in \( \mathrm{C}++ \)
1. In you main( ) function, declare an integer array data[ ] with 100 elements.
2. Write a loop to
All in 1. In you main( ) function, declare an integer array data[ ] with 100 elements. 2. Write a loop to fill data[0] with 1 , data[1] with . and data[99] with 100. (Read class note to , and the book sections labeled in the note) 3. Display from data[20] to data[25]. Separate the numbers with ' '. 4. Declare a double array values[ ] with the following values: , (Read note 4/13) 5. Write a function average ( ). It takes an array as parameter. It returns the average of all the array elements. (Read note and and the textbook) 6. Write a function ). It takes an array as parameter. It returns the biggest value of all the array elements. 7. Back to the main ( ), call the average () to display the average of the array values[ ]. 8. In the main( ), call the () function to display the biggest value of array values[ ].


We have an Answer from Expert

View Expert Answer

Expert Answer



Here's an example code in C++ that fulfills the requirements:



Explanation: The average() function calculates and returns the average of all the elements in the array passed as a parameter. The max() function finds and returns the maximum value among all the elements in the array passed as a parameter. In the main() function, an integer array data[] is declared and filled with values from 1 to 100 using a loop. The numbers from data[20] to data[25] are displayed with a tab separator (\t).


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe