|
|
#include<iostream>
using namespace std;
class employee
{
public:
employee();
~employee();
void setnum(int);
void setgeade(int);
void setmoney(int);
int shownum();
int showgeade();
int showmoney();
private:
int num,grade,money;
}
employee::employee()
{
num=1000;
grade=1;
money=0;
}
employee::~employee() {}
void employee::setnum(int um)
{
num+=um;
}
void employee::setgeade(int de)
{
grade+=de;
}
void employee::setmoney(int ey)
{
money=ey;
}
int employee::shownum()
{
return num;
}
int employee::showgeade()
{
return grade;
}
int employee::showmoney()
{
return money;
}
void main()
{
employee m1;
employee t1;
employee sm1;
employee s1;
cout<<"请输入一个雇员的月薪:";
int ey;
cin>>ey;
m1.setnum(0);
m1.setgeade(3);
m1.setmoney(ey);
cout<<"请输下一个雇员的月薪:";
cin>>ey;
t1.setnum(1);
t1.setgeade(2);
t1.setmoney(ey);
cout<<"请输下一个雇员月薪:";
cin>>ey;
sm1.setnum(2);
sm1.setgeade(2);
sm1.setmoney(ey);
cout<<"请输下一个雇员月薪:";
cin>>ey;
s1.setnum(3);
s1.setmoney(ey);
cout<<"编号"<<m1.shownum<<"级别"<<m1.showgeade<<"本月工资"<<m1.showmoney<<endl;
cout<<"编号"<<t1.shownum<<"级别"<<t1.showgeade<<"本月工资"<<t1.showmoney<<endl;
cout<<"编号"<<sm1.shownum<<"级别"<<sm1.showgeade<<"本月工资"<<sm1.showmoney<<endl;
cout<<"编号"<<s1.shownum<<"级别"<<s1.showgeade<<"本月工资"<<s1.showmoney<<endl;
}
Compiling...
123.cpp
F:\TEMP\123.cpp(19) : error C2533: 'employee::employee' : constructors not allowed a return type
F:\TEMP\123.cpp(52) : error C2264: 'employee::employee' : error in function definition or declaration; function not called
F:\TEMP\123.cpp(53) : error C2264: 'employee::employee' : error in function definition or declaration; function not called
F:\TEMP\123.cpp(54) : error C2264: 'employee::employee' : error in function definition or declaration; function not called
F:\TEMP\123.cpp(55) : error C2264: 'employee::employee' : error in function definition or declaration; function not called
Error executing cl.exe.
123.exe - 5 error(s), 0 warning(s)
我不知道这5个错误出在那里 在线等 谢谢 |
|