您的位置:首页 > 其它

面向对象程序设计上机练习七(类和对象)

2017-11-16 16:51 218 查看


面向对象程序设计上机练习七(类和对象)

Time Limit: 1000MS Memory Limit: 65536KB

Submit Statistic


Problem Description

利用类的数据成员和成员函数完成下列操作:输入三个整数,输出它们的最大值。


Input

输入三个整数。


Output

输出3个整数的最大值。


Example Input

2 8 5



Example Output

8

#include<bits/stdc++.h>
using namespace std;
class x
{
public :
void setpoint()
{
int i;
for(i=0;i<3;i++)
{
cin>>a[i];
}
}
void Set()
{
sort(a,a+3);
}
void showpoint()
{

cout<<a[2]<<endl;

}
private :
int a[6];
};

int main()
{
x a;
a.setpoint();
a.Set();
a.showpoint();
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: