include iostream using namespace std void get Elementsint

  • Slides: 3
Download presentation

#include <iostream> using namespace std; void get. Elements(int a[][3], int row , int column)

#include <iostream> using namespace std; void get. Elements(int a[][3], int row , int column) { for(int i = 0; i < row; i++){ for( int j = 0; j < column; j++) cin>> a[i][j]; } } double sum. Elements(int a[][3], int column) { double sum = 0; for(int i = 0; i < 1; i++){ for( int j = 0; j < column; j++) sum += a[i][j]; } return sum; }

int main() { const int Row = 2; int= 3; main() const int column

int main() { const int Row = 2; int= 3; main() const int column { int a[Row][column]; const int Row = 2; cout<< "Please enter array "; = 3; constelements: int column get. Elements(a, Row, column); int a[Row][column]; cout<< "Sum of array elements is: " << sum. Elements(a, column) << endl; cout<< "Please enter array elements: "; system("pause"); get. Elements(a, Row, column); return 0; } // end main cout<< "Sum of array elements is: " << sum. Elements(a, column) << endl; system("pause"); return 0; } // end main