标签:
#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; }
标签:
原文地址:http://www.cnblogs.com/weijunyu/p/5667214.html