problem
利用类的数据成员和成员函数完成下列要求:
输入三个整数,输出它们的最大值。
code
#include <iostream>
using namespace std;
class MAX
{
private:
int a,b,c;
int max;
public:
void get();
void max_x();
void show();
};
void MAX::get()
{
cin >> a >> b >> c;
}
void MAX::max_x()
{
max = a;
if(max < b)
max = b;
if(max<c)
max =c;
}
void MAX::show()
{
cout << max << endl;
}
int main()
{
MAX m;
m.get();
m.max_x();
m.show();
return 0;
}