#include<iostream>
using namespace std;
const int MaxArry=10000;

class intArray{
protected: int ar[MaxArry];
           int n;
public: intArry(){
            ar[0]=0;
            n=0;
        }
        intArry(int n){
            for(int i=0;i<=n-1;i++)
                ar[i]=i;
        }
        void input(int n){
            int t=0;
            for(int i=0;i<=n-1;i++)
            {
                cout<<"请输入要储存的元素:";
                cin>>t;
                cout<<endl;
                ar[i]=t;
            }
        }
        void print()
        {
            for(int i=0;i<n;i++)
                cout<<ar[i]<<' ';
        }
};
  

class Matrix: public intArray{
private: int rowcount;
         int colcount;
public:  Matrix(){
             rowcount=0;
             colcount=0;
         }
         Matrix(int r,int c){
            rowcount=r;
            colcount=c;
        
            input(c*r);
            n=c*r;
        }
        void shuhl(){
            cout<<"请输入二维数组的行与列:";
            cin>>rowcount>>colcount;
            cout<<endl;
        }
        void output(){
            for(int row=0;row<rowcount;row++)
            {
                for(int col=0;col<colcount;col++)
                    cout<<ar[col+row*colcount]<<' ';
                cout<<'\n';
            }
        }
};
 
int main()
{

    Matrix w(3,2);
    //int();
    w.output();
    return 0;
}