找最大值 int max(int a[],int n) { int maxnum,i; maxnum=0; for(i=0;i<n;i++) { if(a[i]>a[maxnum]) maxnum=i; } return maxnum;//返回最大值下标