#include <iostream>
using namespace std;
template <class Type>
Type max(Type *c,int d)
    {
        Type b=c[0];
        int i;
        for(i=0;i<d;i++)
        {
            if(c[i]>b)
                b=c[i];
        }
        return b;
    }
void main(){
    int size,i;
    cout<<"请输入数组长度"<<endl;
    cin>>size;
    float *p=new float [size];
    for (int i = 0; i < size; i++)
    {
        cout<<"请输入第"<<i+1<<"个数组元素:"<<endl;
        cin>>p[i];
    }
    cout<<"得出结果为:"<<max(p,size)<<endl;
    delete p;
}

 

posted on 2016-07-13 16:01  韦俊宇  阅读(863)  评论(1编辑  收藏  举报