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;
}
代码如上
有点水
欢迎 自己写
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;
}
代码如上
有点水
欢迎 自己写
相关文章推荐
- ajax之“解读原生态ajax”
- Solr之客户端SolrJ
- PHP 500 -Invalid command RewriteEngine的解决 wamp问题1
- 2015070203 - 赵充国
- [Link]选择一个 Python Web 框架:Django vs Flask vs Pyramid
- 安卓词典
- 第8课 LCD控制驱动
- 生产管理系统定制开发的项目流程
- (转载)百度高级搜索方法
- Java知多少(110)数据库之插入记录
- Solr之中文分词
- sdk更新
- C++ 变量名命名规则
- CocoaAsyncSocket网络通信使用之tcp连接(一)
- 第5章Hibernate的基本用法 5.4深入Hibernate的配置文件
- 画刷和画笔
- bzoj1018 [SHOI2008]堵塞的交通traffic
- 微机原理(2)8086
- 词典的实现(4)-使用Hash方式来实现词典
- 【Windows编程】系列第四篇:使用Unicode编程