调用函数的时候出现错误,怎修改,还有应该注意的方面
#include <iostream>using namespace std;
class Employee{
public:
void setName(char name[30],char city[50],int postcode[10]){
cout<<"input the name:"<<endl;
cin.getline(name,30);
cout<<"input the city"<<endl;
cin.getline(city,50);
cout<<"input the postcode:"<<endl;
for(int i=0;i<10;i++){
cin>>postcode[10];};
}
void diaplay(){
cout<<"name:"<<name;
cout<<"city:"<<city;
cout<<"postcode:"<<postcode;
}
private:
char name[30];
char city[50];
int postcode[10];
};
void Employee::setName(char name[30],char city[50],int postcode[10]);
void Employee::diaplay ();
void main(){
Employee p;
p.setName ();
p.diaplay ();
cout<<endl;
}
Compiling...
jfh.cpp
C:\Program Files\VC++\MyProjects\brt\jfh.cpp(35) : error C2660: 'setName' : function does not take 0 parameters
执行 cl.exe 时出错.
jfh.obj - 1 error(s), 0 warning(s)