![](https://cos-cdn.shuashuati.com/pipixue-web/2020-1231-2005-12/ti_inject-812ce.png)
下列程序的功能是求一维数组中最大元素的值及最大元素所处位置。请完善程序,程序的运行结果为: 一维数组为: 3 9 6 9 5 9 8 2 9 7 最大元素的值是:9,其所在位置分别是: 2 4 6 9 #include using namespace std; class Array{ double *p; // 用p指向的动态空间存储要处理的一维数组 double max; // max存放一维数组中元素的最大值 int len; // len存放一维数组的大小(元素个数) public: Array(double *t,int n): len(n) { p= new double[len]; for(int i=0;________;i++) p[i]=t[i]; } void f( ) // 求一维数组中元素的最大值 { max=_______; for(int i=1;i if(p[i]>max)max=p[i]; } void print() // 输出一维数组、最大元素及其位置 { cout< for(int i=0;i cout< cout< for(i=0;i if(p[i]==max)cout< cout< } ~Array() { _____________; } // 释放动态空间 }; int main() { double t[]={3,9,6,9,5,9,8,2,9,7}; Array test(t,sizeof(t)/8); test.f(); test.print(); return 0; }