#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; }