#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define N 10
int fun(int a[],int temp,int *max);
int main()
{
int a[N],temp,max;
printf("请输入10个整数:\n");
for(int i=0;i<N;i++)
{
scanf("%d",&a[i]);
}
fun(a,temp,&max);
printf("这10个整数的最大值是%d,序号为%d",max,fun(a,temp,&max)+1);
return 0;
}
int fun(int a[],int temp, int *max)
{
temp = 0; //将序号初始化为0
*max = a[0]; //数据初始化,将数组第一个元素设为最大值
for(int i=1;i<N;i++)
{
if(*max < a[i])
{
*max = a[i];
temp = i;
}
}
return temp;
}