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

need help to finish this program: Given an array and the size of the array, calc

ID: 3617987 • Letter: N

Question

need help to finish this program: Given an array and the size of the array, calculate and returnthe sum of numbers in the array.
 For example, if the array has values    1,4, 6, 3, 7, 9, 4, 5, 2, 6, 8, 10, 
then it should return 65.
 #include <iostream>#include <fstream>#include <string>using namespace std;



need help to finish this program: Given an array and the size of the array, calculate and returnthe sum of numbers in the array.
 For example, if the array has values    1,4, 6, 3, 7, 9, 4, 5, 2, 6, 8, 10, 
then it should return 65.
 #include <iostream>#include <fstream>#include <string>using namespace std;



Explanation / Answer

#include<iostream>
#include <fstream>
#include <string>
using namespace std;
//function prototypes (You should put necessary function prototypeshere.)
float SumArray(const float[],int size);
int main()
{
float sum;
float array[]={1,4, 6, 3, 7, 9, 4, 5, 2, 6, 8,10};
sum=SumArray(array,12); //callfunction using prototype: dataType SumArray(const dataTypeanArray[], int size);
cout<<"The sum of an array"<<sum;//output results toverify your answer
//Sample output:
system("pause");
return 0;
}//end of main
//---------------