想知道出了什么问题???????
#include <iostream>#include <string>
using namespace std;
class people
{
private:
char name[11];
char number[7];
char sex[3];
char id[16];
public:
people(char *n,char *u,char *s,char *i);
void set();
void display();
};
people::people(char *n,char *u,char *s,char *i)
{
strcpy(name,n);
strcpy(number,u);
strcpy(sex,s);
strcpy(id,i);
}
void people::set()
{
int i;
cout<<"input name,number,sex,id"<<endl;
cout<<"nume:";
for(i=0;i!='\r';i++)
{
cin>>name[i];
}
cout<<"number:";
for(i=0;i!='\r';i++)
{
cin>>number[i];
}
for(i=0;i!='\r';i++)
{
cin>>sex[i];
}
for(i=0;i!='\r';i++)
{
cin>>id[16];
}
}
void people::display()
{
cout<<name<<"\t"<<number<<"\t"<<sex<<"\t"<<id<<endl;
}
int main()
{
int i;
people p[1];
for(i=0;i<1;i++)
{
p[i].set();
}
for(i=0;i<1;i++)
{
p[i].display();
}
return 0;
}
C:\Users\Administrator\Desktop\people.cpp(55) : error C2512: 'people' : no appropriate default constructor available