int len=5; char *p1; cout<<"the char type array and it's length is 5:/n"; cout<<"the array element is a b c d e/n"; p1=new char[len]; for (int i=0;i<len;i++) p1[i]='a'+i; maxofarray(p1,len);
【正确答案】 void maxofarray(atype*p,int count) { for (int j=0;j<count-1;j++) { for (int k=0;k<count-1-j;k++) if(p[k]>p[k+1]) { atype temp; temp=p[k]; p[k]=p[k+1]; p[k+1]=temp; } } cout<<"/nthe max element of this array is: "<<p[count-1]<<endl; }