Answers for "Write a program that: a) initializes a two-dimensional array entered on the keyboard. b) display the result below c) calculate the min, the max, and the sum of the two-dimensional array d) display the result of the calculation"

C
2

c++ code to write 2d array

#include <iostream>
using namespace std;
int main(){
	int n,m;
	int a[n][m];
	cin >> n >>m;
	for ( int i=0; i<n; i++){
		for (int j=0; j<m; j++){
			cin >> a[i][j];
		}
	}
	
	for ( int x=0; x<n; x++){
		for (int y=0; y<m; y++){
			cout << "a[" << x << "][" << y << "]: ";
			cout << a[x][y] << endl;
		}
	}
	return 0;
}
Posted by: Guest on August-11-2020
5

c fill 2d array

// Either
int disp[2][4] = {
  {10, 11, 12, 13},
  {14, 15, 16, 17}
};

// Or 
int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};

// OR
int i, j;
for (i = 0; i < HEIGHT; i++) { // iterate through rows
  for (j = 0; j < WIDTH; j++) { // iterate through columns
    disp[i][j] = disp[i][j];
  }
}
Posted by: Guest on February-27-2020

Code answers related to "Write a program that: a) initializes a two-dimensional array entered on the keyboard. b) display the result below c) calculate the min, the max, and the sum of the two-dimensional array d) display the result of the calculation"

Code answers related to "C"

Browse Popular Code Answers by Language