how creat matrix column in c 2b 2b

Solutions on MaxInterview for how creat matrix column in c 2b 2b by the best coders in the world

showing results for - "how creat matrix column in c 2b 2b"
Jonas
21 Jan 2021
1#include <iostream>
2
3using namespace std;
4
5template <int rows, int cols>
6void display(int (&array)[rows][cols]) {
7  int i, j;
8  cout<<"\n";
9  for(i = 0; i<rows; i++) {
10      for(j = 0; j<cols; j++) {
11        cout<<" ";
12        cout<<array[i][j];
13      }
14      cout<<"\n";
15    }
16}
17
18
19int main() {
20  int M1[3][3];
21  cout<<"Enter your matrix elements: \n";
22  int i, j;
23    for(i = 0; i<3; i++) {
24      for(j = 0; j<3; j++) {
25        cout<<"a["<<i<<"]["<<j<<"]: ";
26        cin>>M1[i][j];
27      }
28    }
29    display(M1);
30  return 0;
31}
32
similar questions
queries leading to this page
how creat matrix column in c 2b 2b