C++ Array Manipulation: Shifting and Summing Elements
The code initializes an array 'a' with the values 1, 1, 2, 3, 5, 8, 13, and 21. It then executes a loop five times. In each iteration, the loop shifts the array elements one position to the left. The last element is replaced with the sum of the three preceding elements. After the loop completes, the code prints the value at the 7th index of the array, which is 144.
Output: 144
原文地址: https://www.cveoy.top/t/topic/mkCM 著作权归作者所有。请勿转载和采集!