//person class
class Person
{
//private:
public:
char name[30];
char type[20];
char date[10];
char id[10];
Person(char pname[],char ptype[],char pdate[],char pid[]);
void addPerson();
void personDelete();
char personFind(char pid[]);
};
//this function find with id and return the name of the person
char Person::personFind(char pid[])
{
fstream readFile;
readFile.open("employee.txt",ios::in);
if(readFile.fail())
{
cout<<"Cannot open file"<<endl;
exit(1);
}
readFile>>id>>name>>type>>date;
while(!readFile.eof())
{
if(id==pid)
{
return name;
//break;
}
readFile>>id>>name>>type>>date;
}
readFile.close();
}
//main
int _tmain(int argc, _TCHAR* argv[])
{
Person *p=new Person("j","j","j","j");
p->addPerson();
cout<<endl;
p->personFind("22");
char ch;
cin>>ch;
return 0;
}
i got this error
Error 5 error C2440: 'return' : cannot convert from 'char [30]' to 'char' c:\users\stephen\desktop\abc company\abc company\supermarket.cpp 91
what is the sollution of this error please help
thank you