Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how creat matrix column in c++

#include <iostream>

using namespace std;

template <int rows, int cols>
void display(int (&array)[rows][cols]) {
  int i, j;
  cout<<"
";
  for(i = 0; i<rows; i++) {
      for(j = 0; j<cols; j++) {
        cout<<" ";
        cout<<array[i][j];
      }
      cout<<"
";
    }
}


int main() {
  int M1[3][3];
  cout<<"Enter your matrix elements: 
";
  int i, j;
    for(i = 0; i<3; i++) {
      for(j = 0; j<3; j++) {
        cout<<"a["<<i<<"]["<<j<<"]: ";
        cin>>M1[i][j];
      }
    }
    display(M1);
  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ program to convert celsius to kelvin 
Cpp :: initialising 2d vector 
Cpp :: convert wchar_t to to multibyte 
Cpp :: long long int range c++ 
Cpp :: c++ namespace example 
Cpp :: sum of first 100 natural numbers 
Cpp :: how to convert hexadecimal to decimal in c++ 
Cpp :: heredar constructor c++ 
Cpp :: cpp ignore warning in line 
Cpp :: how to reset linerenderer unity 
Cpp :: Initialize Vector Iterator Through Vector Using Iterators 
Cpp :: how to fill vector from inputs c++ 
Cpp :: store array in vector 
Cpp :: minheap cpp stl 
Cpp :: c++ list of pairs 
Cpp :: balanced brackets in c++ 
Cpp :: greatest and smallest in 3 numbers cpp 
Cpp :: get function in cpp. 
Cpp :: delete c++ 
Cpp :: queue operations c++ 
Cpp :: C++ Vector Operation Delete Elements 
Cpp :: A Program to check if strings are rotations of each other or not 
Cpp :: c++ comment 
Cpp :: data type c++ 
Cpp :: ifstream file (“code2.txt”); dev C++ 
Cpp :: recherche recursive le max dans une liste 
Cpp :: surf interpolation matlab 
Cpp :: how to create windows warning message c++ 
Cpp :: qtextedit no line break 
Cpp :: print float up to 3 decimal places in c++ 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =