指针数组和指针的区别。

#include
#include
#define N 10
using namespace std;
class Base
{
public:
int No;
int ID;
char Name[10];
char Sex[10];
char Birthday[10];
char Address[20];
int Phone;
void inputBase()

{ cout<<"输入员工的工作号:"< cin>>No;

cout<<"输入员工的姓名:"< cin>>Name;

cout<<"输入员工的性别:"< cin>>Sex;

cout<<"输入员工的身分证:"< cin>>ID;

cout<<"输入员工的生日:"< cin>>Birthday;

cout<<"输入员工的家庭住址:"< cin>>Address;

cout<<"输入员工的家庭电话号码:"< cin>>Phone;
}
void outputBase()
{
cout<<"工作号:"< }
};
class Personnel:public Base
{
public:
virtual void showper()
{
cout }
char Job[10];
int Pay;
void intputper()
{
cout cin>>Job;
cout<<"请输入该员工的薪水"< cin>>Pay;
}
void outputper()
{
cout<<"职务:"< }
};
//Personnnel *P[10];
//*P=new Personnal;*/
class Maintain:public Personnel //维修部
{
public: virtual void show()
{
cout }
};
void intsertper()
{
int n;
do
{
Personnel *p;
Personnel (*P)[10];
p=new Personnel;
p->showper();
p->inputBase();
p->intputper();
int q;
do
{

for(int i=0;i {
q=0;
if(P[i]==NULL)
{
break;
}
else if(P[i]->No==p->No)
{
cout<<"此工作号已存在!请修改~!"< p->inputBase();
p->intputper();
q++; break;
}
}

}
while(q!=0);
for(int j=0;j {
if(P[j]==NULL)
{
P[j]=*p;
cout break;
}
}
cout>n;
}
while(n==1);
}
void show()//显示数据

{
Personnel *p;
Personnel (*P)[10];
//cout< for(int j=0;j {
if(P[j]!=NULL)
{
p=P[j];
p->outputBase();

p->outputper();

}
}
}

int main()
{
int n;
cin>>n;
if(n=1)
{
intsertper();
}
else if(n!=1)
{
show();
}
return 0;

}
问题:
[Error] incompatible types in assignment of 'Personnel' to 'Personnel [10]'

 Personnel (*P)[10];  //定义了指针数组
p=new Personnel;   //试图将一个指针变量赋值给数组

这样操作不正确,可以这样:

Personnel P;
P = new Personnel;

或者这样:

 Personnel (*P)[10]; 
P[index]  =  new Personnel   // index可以是0-9中的某个整数,代表数组的第i个元素

用心回答每个问题,如果对您有帮助,请采纳答案好吗,谢谢!