#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
bool find_max_min(int a[], int len, int* max, int* min) {
if (len < 1) return false;
*max = a[0];
*min = a[0];
for (int i = 0; i < len; i++) {
if (*max < a[i]) {
*max = a[i];
}
if (*min > a[i]) {
*min = a[i];
}
}
return true;
}
int main() {
int a[10] = { 8,4,6,2,9,11,7,15,9,1 };
int max = 0, min = 0;
find_max_min(a, 10, &max, &min);
cout << "max:" << max << ",min:" << min << endl;
system("pause");
return 0;
}