3个人工资水平

来源:互联网 发布:软件著作权转让税率 编辑:程序博客网 时间:2024/05/02 02:31
#include<iostream>
using namespace std;
class Fqu{
public:
Fqu(double r=0.0);
void print();
Fqu operator+(Fqu c);
private:
double real;
};
Fqu::Fqu(double r)
{
real=r;
}
Fqu Fqu::operator +(Fqu c)
{
Fqu t;
t.real=real+c.real;
return t;
}
void Fqu::print()
{
cout<<"Allsalary is:"<<real<<endl;
}
int max(double q1,double q2)
{
if(q1>=q2)
return q1;
else
return q2;
}




int main()
{
char a[100];
char b[100];
char c[100];
double x,y,z;
double w,t;
while(cin>>a>>x>>b>>y>>c>>z)
{
cout<<a<<"  "<<x<<endl;
cout<<b<<"  "<<y<<endl;
cout<<c<<"  "<<z<<endl;
Fqu A(x),B(y),C(z),D,E;
D=A+B;
E=C+D;
E.print();
w=max(x,y);
t=max(w,z);
if(t==x)
{
cout<<"The highest salary is:"<<a<<"  "<<x<<endl;
}
else if(t==y)
{
cout<<"The highest salary is:"<<b<<"  "<<y<<endl;
}
else if(t==z)
{
cout<<"The highest salary is:"<<c<<"  "<<z<<endl;
}
}
return 0;

}



代码如上

有点水


欢迎   自己写

0 0