- 1
A C++ program that read and store a series of integers and then computes the sum of the first N integer value.
The question said, write a program that read and store a series of integers and then computes the sum of the first N integers. First ask for N, then read the value into an array, then calculate the sum of the first N values for example. "Pls enter the number of values you want to sum" '3' "Pls enter some integers (press 's' to stop)" '12,23,45,67,21,65' The sum of first 3 numbers (12,23,45) is 80 Handle all input for example make sure to give an error message if the user asks for a sum of more number than the vector.
1 Antwort