input matrice

how to enter matrices in c++ like in matlab?
Last edited on
Hey,

do you mean:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <vector>

int main ( ) 
{
     std::vector<int> MyVector ;
     // fill it
     MyVector.push_back(1) ;
     MyVector.push_back(2) ;
     MyVector.push_back(3) ;
     MyVector.push_back(4) ;
     // print it
     for ( std::vector<int>::iterator it = MyVector.begin(), end = MyVector.end() ; it != end ; ++it )
          std::cout << *it << std::endl ;
     
     return 0 ;
}


1
2
3
4
5
Output:
1
2
3
4



bye
Topic archived. No new replies allowed.