void get()输入语句报错
#include <iostream>
using namespace std;
class Array
{
private:
int column,row;
int *p;
public:
Array() {}
Array(int a,int b)
{column=a;
row=b;
p=new int[column*row];}
~Array()
{delete []p;}
void get()
{
cout<<"请输入矩阵,行为:"<<row<<"列为:"<<column<<endl;
for(int i=0; i<row; i++)
for(int j=0; j<column; j++)
cin>>p[i][j];
}
Array operator+(Array &b)
{ if(row!=b.row || column!=b.column)
cout<<"不可相加";
else
{Array tmp;
for(int i=0; i<row; i++)
for(int j=0; j<column; j++)
tmp.p[i][j]=p[i][j]+t.p[i][j];
return tmp;}
}
void show()
{
for(int i=0; i<row; i++)
{
for(int j=0; j<column; j++)
{
cout<<a[i][j]<<" ";
}
cout<<"\n";
}
cout<<"------------------"<<endl;
}
};
int main()
{
Array c1,c2,c3;
c1.get();
c2.get();
c1.show();
c2.show();
c3=c1+c2;
c3.show();
return 0;
}