int main()
{
int arr[] = { 1, 7, 3, 2, 9, 10, 7, 4};
int length = sizeof(arr) / sizeof(*arr), maxFall = 0;
for(int i =1, elem = arr[0], fall = 0; i<length; ++i)
((elem < arr[i]) && (elem = arr[i],1)) || (((fall=elem-arr[i]) > maxFall)
&& (maxFall = fall));
cout<<"MaxFall = "<<maxFall<<'\n';
return 0;
}
No comments:
Post a Comment