Question: pleas typing Consider the following code segment: int index = -1; 2 int arr[5]; 3 int x; 4 for (x = 0; x < 5;
pleas typing
Consider the following code segment: int index = -1; 2 int arr[5]; 3 int x; 4 for (x = 0; x < 5; x++) 5. arr[x] = (x +5); 7. do { 8. cout << "Enter a valid index (0 - 4): "; 9.cin >> index; 10 } while (index < 0 1I index > 4); 12 cout <<" The value of index " << index 13 < " is " << arr[index] < edl;
Identify the output of the above code if: a) value of index entered at line 8 is 2 b) value of index entered at line 8 is 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
