C Primer Plus 第六章第十二題

12. Write a program that creates two eight-element arrays of double and uses a loop to let the user enter values for eight elements of the first array. Have the program set the elements of the second array to the cumulative totals of the elements of the first array. For example, the fourth element of the second array should equal the sum of the first four elements of the first array, and the fifth element of the second array should equal the sum of the first five elements of the first array. Finally, use a loop to display the contents of the two arrays, with the first array displayed on one line and with each element of the second array displayed below the corresponding element of the first array.

Posted in 碎碎念

Leave a Reply

Your email address will not be published.