#include<iostream>
using namespace std;
int main()
{
int i, z = 0, min, max;
int a[8] = { 12,23,34,45,56,67,78,89 };
max = a[0];
min = a[0];
for (i = 0; i < 8; i++)
{
if (min > a[i])
min = a[i];
else
if (max < a[i])
max = a[i];
}
cout << "该数组中最大值为:"<<max<<"\n最小值为:"<<min;
system("pause");
return 0;
}
Last modification:December 5th, 2018 at 07:19 pm
© 允许规范转载