- Back to Home »
- Cplusplus »
- [C++]Nhập xuất ma trận C++
Posted by : 86Gems
26 February 2014
#include <iostream>
using namespace std;
int main ()
{
int n,m,i,j ;
cout << " Nhap so hang: ";
cin >> n;
cout << endl;
cout <<" Nhap so cot: ";
cin >> m;
cout << endl;
int a[n][m];
for (i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cout << "Nhap gia tri a[" << i+1 <<"][" << j+1 <<"]: ";
cin >> a[i][j] ;
cout << endl;
}
}
cout << "Ma tran da nhap vao la: " << endl;
for ( i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cout << a[i][j] << " ";
}
cout << endl;
}
return(0);
}