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

来源:互联网 发布:无线点菜机软件 编辑:程序博客网 时间:2024/05/21 17:49

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

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;}


阅读全文
0 0