Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. Write C++ statements to define and initialize the following arrays using appr

ID: 3629942 • Letter: 4

Question

4. Write C++ statements to define and initialize the following arrays using appropriate data types:

a. An array of heights has 6 components which have the following values: 5.5, 5.8, 6.3, 6.6, 4.9, 5.9.
b. An array of weights has 4 components which have the values: 140, 165, 190, 207.
c. An array of symbols which contains the following characters: '$', '%', '@', '!', '|', '&'.
d. An array of the seasons which contains "Spring", "Summer", "Fall", "Winter".

5. Given the following declaration, what is stored in the 8th element of the array?
int list[10] = {1, 2, 3, 4, 5};

6. When an array is passed as an actual parameter to a function, what is really being passed in to the function? Why are arrays passed this way?

Explanation / Answer

a. double heights[6] = {5.5, 5.8, 6.3, 6.6, 4.9, 5.9};

int weights[4]= { 140, 165, 190, 207};

char symbols[6]={'$', '%', '@', '!', '|', '&'};

string season[4]={"Spring", "Summer", "Fall", "Winter"};

5)

list[8] = 0

6) address of array

this is pass by reference... gives u flexibilityto change array inside function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote