求第四章的联系完整代码
自己做不出来了呜呜
自己做不出来了呜呜
2017-03-10
#include <iostream>
#include "stdlib.h"
using namespace std;
int getMax(int a, int b)
{
return a > b ? a : b;
}
//int numArr[3] = { 3, 8, 6 };
int getMax(int arr[], int count)
{
int maxNum = arr[0];
for (int i = 1; i < count; i++)
{
if (arr[i] > maxNum)
{
maxNum = arr[i];
}
}
return maxNum;
}
int main(void)
{
int numArr[4] = { 3, 8, 6 };
cout << getMax(3, 6) << endl;
cout << getMax(numArr, 3) << endl;
system("pause");
}
举报