请详细地告诉我犯的错误是什么,该怎样改?不胜感激!

/*fuction:Theinformationoftheemplyee;author:wendy;date:2011-10-15;version:1.0;*/#incl... /*
fuction:The information of the emplyee;
author:wendy;
date:2011-10-15;
version:1.0;
*/

#include<iostream>
#include<cstring>

class employee
{
private:
string name; //the name of the employee;
string str_addr; //the stress address of the employee;
string city; //the city where employee live;
string province; //province where employee belong to;
int po_number; //the post number of employee;
public:
employee(); //to intialize the information of the employee;
employee(string name,string str_addr,string city,string province,int po_number); //input the information of the employee;
void display(); //input the information of the employee;
};

employee::employee()
{
name="wendy";
str_addr="block 2";
city="meizhou";
province="guangdong";
po_number=514581;
}
void employee::employee(string name,string str_addr,string city,string province,int po_number)
{
this->name=name;
this->str_addr=str_addr;
this->city=city;
this->province=province;
this->po_number=po_number;
void display();
}

void employee::display()
{
cout<<"the information of the employee is as following :"<<endl;
cout<<"name:"<<name<<endl;
cout<<"street:"<<str_addr<<endl;
cout<<"city:"<<city<<endl;
cout<<"province:"<<province<<endl;
cout<<"post number:"<<po_number<<endl;
}

int main()
{

employee p;
char a[30],b[30],c[30],d[30];
int i;
cout<<"please input the information of the employee--name,street,city,province,post number:"<<endl;
cin>>a>>b>>c>>d>>i;
employee(a,b,c,d,i);
return 0;
}
展开
 我来答
Eli2021
2011-10-16 · TA获得超过664个赞
知道小有建树答主
回答量:1266
采纳率:72%
帮助的人:394万
展开全部
看注释中有Eli的地方:

/*
fuction:The information of the emplyee;
author:wendy;
date:2011-10-15;
version:1.0;
*/

#include <iostream>
#include <string>//Eli:根据下文这里应该是string

using namespace std; // Eli: 要加命令空间,你后面才能直接使用该命名空间内的符号

class employee
{
private:
string name; //the name of the employee;
string str_addr; //the stress address of the employee;
string city; //the city where employee live;
string province; //province where employee belong to;
int po_number; //the post number of employee;
public:
employee(); //to intialize the information of the employee;
employee(string name,string str_addr,string city,string province,int po_number); //input the information of the employee;
void display(); //input the information of the employee;
};

employee::employee()
{
name="wendy";
str_addr="block 2";
city="meizhou";
province="guangdong";
po_number=514581;
}
employee::employee(string name,string str_addr,string city,string province,int po_number)
{
this->name=name;
this->str_addr=str_addr;
this->city=city;
this->province=province;
this->po_number=po_number;
void display();
}

void employee::display()
{
cout<<"the information of the employee is as following :"<<endl;
cout << "name:" << name << endl;
cout<<"street:"<<str_addr<<endl;
cout<<"city:"<<city<<endl;
cout<<"province:"<<province<<endl;
cout<<"post number:"<<po_number<<endl;
}

int main()
{

employee p;
char a[30],b[30],c[30],d[30];
int i;
cout<<"please input the information of the employee--name,street,city,province,post number:"<<endl;
cin>>a>>b>>c>>d>>i;
employee(a,b,c,d,i);
return 0;
}
追问
谢谢,程序中的其他问题我已经搞定了
“#include //Eli:根据下文这里应该是string“这个在我的教科书上用的是
总之,非常感谢!
追答
既然有书,那你应该明白 以下三行的区别吧:
#include
#include
#include

另外,你上面这个程序,如果你用#include 可以运行,那么去掉#include
照样还可以运行。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式