How can I write a separate function that sums up all the values of the cells of the array that I inserted it below and then show the total in the main function.
#include <iostream>
#define height 2
#define width 3
usingnamespace std;
int x,y;
int main ()
{
int eidan[height][width];
for (x=0;x<height;x++)
for (y=0;y<width;y++)
{
cout <<"Enter the value\n";
cin >> eidan[x][y];
cout << "\n\n";
}
int accumulator=0;
for (x=0;x<height;x++)
for (y=0;y<width;y++)
{
accumulator = accumulator+eidan[x][y];
}
cout<<accumulator<<"/n";
system ("pause");
return 0;
}