using namespace std;
int getMax(int&arr,count)
{
//定义一个变量并获取数组的第一个元素
int maxNum=arr[0]
for(int i = 1; i < count; i++)
{
//比较变量与下一个元素的大小
if(maxNum
{
//如果数组中的元素比maxNum大,则获取数组中的值
maxNum=arr[i]
}
}
return maxNum;
}
int main(void)
{
//定义int数组并初始化
int numArr[3] = {3, 8, 6};
//自动调用int getMax(int a, int b) cout << getMax(3, 6) << endl; //自动调用返回数组中最大值的函数返回数组中的最大值 cout << getMax(numArr,3) << endl; return 0;
}



