int getMax(int a, int b){return a > b ? a : b;}
int getMax(int *a) { int maxNum = a[0]; for(int i = 1; i < 3; i++) { if(maxNum < a[i]){maxNum = a[i];}}return maxNum; } int main(void) { int numArr[3] = {3, 8, 6}; cout << getMax(3, 6) << endl;
cout << getMax(numArr) << endl;
return 0;
}
int getMax(int *a) { int maxNum = a[0]; for(int i = 1; i < 3; i++) { if(maxNum < a[i]){maxNum = a[i];}}return maxNum; } int main(void) { int numArr[3] = {3, 8, 6}; cout << getMax(3, 6) << endl;
cout << getMax(numArr) << endl;
return 0;
}