c++中,用指针找出数组里的最大值

如题所述

程序代码是:
#include<iostream.h>
int main()
{
int Array[100]={0};
int number,i;
int *point;
cout<<"input the nubmer of the array member:";
cin>>number;
point=Array;
for(i=1;i<=number;i++)
{
cout<<"input the value of the Array["<<i<<"]:";
cin>>Array[i-1];
if(*point<Array[i-1])
point=Array+i-1;
}
cout<<"The max number is :"<<*point<<endl
<<"The location is :"<<point-Array+1<<endl;
return 0;
}
温馨提示:答案为网友推荐,仅供参考
相似回答