执行 cl.exe 时出错!C++高手帮我看看那里出错呀,帮忙改过来!谢谢

hunxiao hunxiao 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include<iostream.h>
#include<stdlib.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
class employee
{
public:
employee()
{
salary=0;
}
void pay(){}
void print(){}
void input()
{
cout<<"ID:";
cin>>no;
cout<<" NAME:";
cin>>name;
cout<<" SEX(m/w):";
cin>>sex;
cout<<" AGE:";
cin>>age;
}
protected:
int no;
char name[8];
float salary;
char sex;
int age;

};
class manager:virtual public employee
{
protected:
float monthlypay,sale;
public:
manager(){monthlypay=8000;}
void input(){cout<<"Manger";employee::input();}
void save()
{
fstream outfile;
outfile.open("f:flsdfj.txt",ios::app);
if(!outfile)
{
cout<<"f can't open.\n";
abort();
}
outfile<<"Manger"<<endl;
outfile<<"ID"<<no<<"NAME"<<name<<"SEX"<<sex<<"AGE"<<age<<"SALARY"<<salary<<endl;
}
void pay(){salary=monthlypay;}
void print()
{
cout<<"├─────┼─────┼─────┼─────┼─────┤"<<endl;
cout<<"│"<<setw(10)<<no<<"│"<<setw(10)<<name<<"│"<<setw(10)<<sex\
<<"│"<<setw(10)<<age<<"│"<<setw(10)<<salary<<"│"<<endl;
}
};

class technician:virtual public employee
{
private:
float hourlyrate;
int workhours;
public:
technician(){hourlyrate=100;}
void pay()
{
cout<<name<<"Work hour:";
cin>>workhours;
salary=hourlyrate*workhours;
}
void input(){cout<<"TECHNICIAN"<<endl;employee::input();}
void save()
{
fstream outfile;
outfile.open("f:flsdfj.txt",ios::app);
if(!outfile)
{
cout<<"f can't open.\n";
abort();
}
outfile<<"TECHNICIAN"<<endl;
outfile<<"ID"<<no<<"NAME"<<name<<"SEX"<<sex<<"AGE"<<age<<"SALARY"<<salary<<endl;
}
void print()
{
cout<<"├─────┼─────┼─────┼─────┼─────┤"<<endl;
cout<<"│"<<setw(10)<<no<<"│"<<setw(10)<<name<<"│"<<setw(10)<<sex\
<<"│"<<setw(10)<<age<<"│"<<setw(10)<<salary<<"│"<<endl;
}
};
class salesman:virtual public employee
{
protected:
float commrate;
float sales;
public:
salesman(){commrate=0.04;}
void input(){cout<<"SALEMAN";employee::input();}
void save()
{
fstream outfile;
outfile.open("f:flsdfj.txt",ios::app);
if(!outfile)
{
cout<<"f can't open.\n";
abort();
}
outfile<<"TECHNICIAN"<<endl;
outfile<<"ID"<<no<<"NAME"<<name<<"SEX"<<sex<<"AGE"<<age<<"SALARY"<<salary<<endl;
}
void pay()
{
cout<<name<<"Sales volume:";
cin>>sales;
salary=sales*commrate;
}
void print()
{
cout<<"├─────┼─────┼─────┼─────┼─────┤"<<endl;
cout<<"│"<<setw(10)<<no<<"│"<<setw(10)<<name<<"│"<<setw(10)\
<<sex<<"│"<<setw(10)<<age<<"│"<<setw(10)<<salary<<"│"<<endl;
}
};

...全文
评论 2
收藏 已收藏
分享
返回顶部
hunxiao
C++ 语言 65,214 成员 250,514 内容