matrix of 2 * 2

//Matrix 2*2 #include <iostream.h> int main() { int i; int mat [2]; int matr [2]; for(i=0; i<2; i++) cout<<mat<<endl; cout<<matr<<endl; system("pause"); return 0; }
What's the problem?

You wrote:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//Matrix 2*2 
#include <iostream.h> 
int main() 
{ 
	int i; 
	int mat [2]; 
	int matr [2]; 
	
	for(i=0; i<2; i++) 
		cout<<mat<<endl; 
	
	cout<<matr<<endl; 
	
	system("pause"); 
	return 0; 
}


To make a 2x2 matrix just do this:
int mat[2][2];
map <int,int> matrix; another way of doing things.
also <iostream.h> is outdated in the new version of c++ and some compilers will tell you it is depreciated. do <iostream> and it works just fine. along with removing the system pause, which is not generally the best thing to use.
Last edited on
Topic archived. No new replies allowed.