您的位置:首页 > 其它

3个人工资水平

2015-07-02 21:43 288 查看
#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;
}

代码如上

有点水

欢迎   自己写
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: