#include<iostream>
#include<vector>
using namespace std;
void inputM(vector<vector<int>> &T)
{
int i, j, d, row, col;
vector<int> R;
cout << "Enter the row and column: ";
cin >> row >> col;
cout << "Enter the matrix:" << endl;
for(i=0; i<row; ++i)
R.clear();
for(j=0; j<col; ++j)
cin >> d;
R.push_back(d);
}
T.push_back(R);
void printM(vector<vector<int>> &T)
int i, j, row = T.size(), col = T[0].size();
cout << T[i][j] << " ";
cout << endl;
int main()
/*typedef*/ vector<vector<int>> T;
inputM(T);
printM(T);
#include<iostream>
#include<vector>
using namespace std;
void inputM(vector<vector<int>> &T)
{
int i, j, d, row, col;
vector<int> R;
cout << "Enter the row and column: ";
cin >> row >> col;
cout << "Enter the matrix:" << endl;
for(i=0; i<row; ++i)
{
R.clear();
for(j=0; j<col; ++j)
{
cin >> d;
R.push_back(d);
}
T.push_back(R);
}
}
void printM(vector<vector<int>> &T)
{
int i, j, row = T.size(), col = T[0].size();
for(i=0; i<row; ++i)
{
for(j=0; j<col; ++j)
cout << T[i][j] << " ";
cout << endl;
}
}
int main()
{
/*typedef*/ vector<vector<int>> T;
inputM(T);
printM(T);
}