#include<iostream>
using namespace std;
class Point { //类的定义
public: //外部接口
int max, min, sum;
void get(int NewX, int NewY);
int x, y;
};
void Point::get(int newX, int newY)
{
x = newX;
y = newY;
}
int main()
{
int max, min,sum;
Point a[10];
for (int i = 0;i < 10;i++)
{
a[i].x=i;
a[i].y = i;
}
max = a[0].x;
min = a[0].x;
sum = a[0].x;
for (int j = 1;j < 10;j++)
{
if (a[j].x > max)
max=a[j].x;
if (a[j].x < min)
min=a[j].x;
sum += a[j].x;
}
cout << max << ' ' << min << endl;
cout << (sum / 10) << endl;
}
实验14 任务4
最新推荐文章于 2023-12-25 22:58:11 发布