/*
Description
输入n个数,找出最大的数并输出。
Input
输入n,并输入n个数。
Output
输出的最大的数,每个输出结果占一行。
Sample Input
10
1 2 3 4 5 6 7 8 9 10
Sample Output
10
*/
#include <iostream>
using namespace std;
class Q
{
public:
//此处声明需要的成员函数
void set_value();
double get_Max();
private:
int n;
int a[100];
};
//下面定义成员函数
void Q::set_value()
{
cin>>n;
for(int i=0; i<n; i++)
{
cin>>a[i];
}
}
double Q::get_Max()
{
for(int i=1; i<n; i++)
{
if(a[i]>a[0])
{
a[0]=a[i];
}
}
return a[0];
}
//用main()函数测试,完成输入输出
int main()
{
Q b1;
b1.set_value();
cout<<b1.get_Max()<<endl;
return 0;
}
爽!