问题
问答题
编写方法int searchMaxNumIndex(int[]a),寻找已知数组中最大数的下标并返回。
答案
参考答案:int searchMaxNumIndex(int[]a) {
int i,maxIndex;
for(i=maxIndex=0;i<a.length;i++) {
if(a[i]>a[maxIndex])
maxIndex=i;
}
return maxIndex;
}