#include <iostream>
using namespace std;
class Juzhen
{
public:
static void set1();
//void set1();
void set2();
void display();
private:
static int x;
static int y;
//int x;
//int y;
int*p;
};
void Juzhen::set1()
{
cout<<"输入行数和列数"<<endl;
cin>>x>>y;
}
void Juzhen::set2()
{
int a=(x-1)*(y-1);
p=new int [a];
cout<<"输入一个"<<x<<"行"<<y<<"列的矩阵"<<endl;
for(int i=0,b=0;i<x;i++)
for(int j=0;j<y;j++,b++)
cin>>p[b];
cout<<endl;
}
void Juzhen::display()
{
for(int i=0,b=0;i<x;i++){
for(int j=0;j<y;j++,b++)
cout<<p[b]<<" ";
cout<<endl;}
}
int main()
{
Juzhen j1;
Juzhen::set1();
//j1.set1();
j1.set2();
j1.display();
return 0;
}
错误报告:
--------------------Configuration: 的 - Win32 Debug--------------------
Linking...
lizi.obj : error LNK2001: unresolved external symbol "private: static int Juzhen::x" (?x@Juzhen@@0HA)
lizi.obj : error LNK2001: unresolved external symbol "private: static int Juzhen::y" (?y@Juzhen@@0HA)
Debug/的.exe : fatal error LNK1120: 2 unresolved externals
执行 link.exe 时出错.
的.exe - 1 error(s), 0 warning(s)
请问这是什么错误啊?怎样才能解决啊?谢谢~~